usaco5.3.2 Window Area

Visual Studio报错TRK0005找不到CL.exe?三步彻底解决环境变量问题 本文详细解析了Visual Studio报错TRK0005找不到CL.exe的根本原因,并提供了三步彻底解决环境变量问题的方案。从验证安装完整性到配置永久环境变量,再到注册表级修复,帮助开发者建立健壮的开发环境配置体系,确保编译链稳定运行。 阅读详情

一 原题

Window Area
IV Balkan Olympiad

You've just be assigned the project of implemented a windowing interface. This windowing interface is fairly simple, and fortunately, you don't have to display the actual windows. There are 5 basic operations:

  1. Create a window
  2. Bring a window to the top
  3. Put a window to the bottom
  4. Destroy a window
  5. Output what percentage of a window is visible (i.e., isn't covered by windows above it).

In the input, the operations appear in the following format:

  • Create window: w(I,x,y,X,Y)
  • Bring window to top: t(I)
  • Put window on bottom: b(I)
  • Destroy window: d(I)
  • Output percentage visible: s(I)
The I is a unique identifier for each window, which is one character. The character can be any of 'a'..'z', 'A'..'Z', and '0'..'9'. No extra spaces will appear in the input.

(x,y) and (X,Y) are opposite corners of the window. When a window is created, it is put `on top'. You can't create a window with an identifier that is already in use, but you can destroy a window and then create a new one with the identifier of the destroyed window. Coordinates will be positive integers, and all windows will be of non-zero area (x != X and y != Y). The x and y coordinates are between 1 and 32767 inclusive.

PROGRAM NAME: window

INPUT FORMAT

The input file consists of a sequence of commands to your interpreter. They will be listed one per line. Terminate the program when no more input is available

SAMPLE INPUT (file window.in)

w(a,10,132,20,12)
w(b,8,76,124,15)
s(a)

OUTPUT FORMAT

Output lines only for the s() commands. Of course, there might be several s() commands (but no more than 500) so the output should be a sequence of percentages, one per line, stating the percentage of the windows that are visible. The percentages should be rounded to 3 decimal places.

SAMPLE OUTPUT (file window.out)

49.167


二 分析

维护一个windows的序列,在每次创建,置顶,置底,删除操作后都更新序列,这里我用的是naive的更新方法,每次更新时间复杂度是O(n)的,n是序列长度。
遇到需要输出的时候,使用漂浮法算出可见面积就行啦。


三 代码

运行结果:
USER: Qi Shen [maxkibb3]
TASK: window
LANG: C++

Compiling...
Compile: OK

Executing...
   Test 1: TEST OK [0.000 secs, 4188 KB]
   Test 2: TEST OK [0.000 secs, 4188 KB]
   Test 3: TEST OK [0.000 secs, 4188 KB]
   Test 4: TEST OK [0.000 secs, 4188 KB]
   Test 5: TEST OK [0.000 secs, 4188 KB]
   Test 6: TEST OK [0.000 secs, 4188 KB]
   Test 7: TEST OK [0.000 secs, 4188 KB]
   Test 8: TEST OK [0.000 secs, 4188 KB]
   Test 9: TEST OK [0.000 secs, 4188 KB]
   Test 10: TEST OK [0.000 secs, 4188 KB]
   Test 11: TEST OK [0.000 secs, 4188 KB]

All tests OK.

Your program ('window') produced all correct answers! This is your submission #3 for this problem. Congratulations!


AC代码:
/*
ID:maxkibb3
LANG:C++
PROB:window
*/

#include<cstdio>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cmath>
using namespace std;

struct Window {
	char id;
	int x1, y1, x2, y2;

	double area() {
		return (double)abs((x2 - x1) * (y2 - y1));
	}
};

Window mk_window(char _id, int _x1,
		int _y1, int _x2, int _y2) {
	Window ret;
	ret.id = _id;
	ret.x1 = _x1;
	ret.y1 = _y1;
	ret.x2 = _x2;
	ret.y2 = _y2;
	return ret;
}

vector<Window> windows;

int find_window(char _id) {
	for(int i = 0; i < windows.size(); i++) {
		if(_id == windows[i].id) return i;
	}
	printf("Shall not see this!\n");
	return -1;
}

void create(char *_s) {
	int pos[4];
	int cnt = 0;
	int len = strlen(_s);
	for(int i = 2; i < len; i++) {
		if(_s[i] == ',') {
			pos[cnt++] = i;
			_s[i] = '\0';
		}
		if(_s[i] == ')')
			_s[i] = '\0';
	}
	char id = _s[2];
	int x1 = atoi(_s + pos[0] + 1);
	int y1 = atoi(_s + pos[1] + 1);
	int x2 = atoi(_s + pos[2] + 1);
	int y2 = atoi(_s + pos[3] + 1);
	if(x1 > x2) swap(x1, x2);
	if(y1 < y2) swap(y1, y2);
	windows.push_back(mk_window(id, x1, y1, x2, y2));
}

void top(char *_s) {
	char id = _s[2];
	int idx = find_window(id);
    Window w = windows[idx];
    windows.erase(windows.begin() + idx);
    windows.push_back(w);
}

void bottom(char *_s) {
	char id = _s[2];
	int idx = find_window(id);
    Window w = windows[idx];
    windows.erase(windows.begin() + idx);
    windows.insert(windows.begin(), w);
}

void destroy(char *_s) {
	char id = _s[2];
	int idx = find_window(id);
	windows.erase(windows.begin() + idx);
}

double up(Window _w, int _idx) {
	if(_w.x1 > _w.x2 || _w.y1 < _w.y2) return 0;
	if(_idx == windows.size()) return _w.area();
	double ret = 0;
	Window w = windows[_idx];
	ret += up(mk_window('_', _w.x1, _w.y1,
		min(_w.x2, w.x1), _w.y2), _idx + 1);
	ret += up(mk_window('_', max(_w.x1, w.x2),
		_w.y1, _w.x2, _w.y2), _idx + 1);
	ret += up(mk_window('_', max(_w.x1, w.x1), _w.y1,
		min(w.x2, _w.x2), max(_w.y2, w.y1)), _idx + 1);
	ret += up(mk_window('_', max(_w.x1, w.x1),
		min(_w.y1, w.y2), min(_w.x2, w.x2), _w.y2), _idx + 1);
	return ret;
}

void calc(char *_s) {
	char id = _s[2];
	int idx = find_window(id);
	double seen = up(windows[idx], idx + 1);
	printf("%.3f\n", seen / windows[idx].area() * 100);
}

void solve() {
	char s[50];
	while(scanf("%s", s) != -1) {
		if(s[0] == 'w')
			create(s);
		else if(s[0] == 't')
			top(s);
		else if(s[0] == 'b')
			bottom(s);
		else if(s[0] == 'd')
			destroy(s);
		else
			calc(s);
	}
}

int main() {
	freopen("window.in", "r", stdin);
	freopen("window.out", "w", stdout);
	solve();
	return 0;
}


备战2025数学建模国赛(算法46):多目标优化 本篇博客将深入浅出地介绍多目标优化的核心概念、主流算法,并重点结合一个数学建模竞赛的经典案例,提供完整的Python代码实现,助你在未来的竞赛中游刃有余。它通过寻找帕累托最优解集,完美地诠释了“鱼与熊掌不可兼得”的权衡思想,为最终决策提供科学依据。这些问题都包含多个相互冲突的目标,传统的单目标优化方法(如梯度下降、单纯形法)对此无能为力,因为它们无法同时优化多个目标。在数学建模竞赛中,我们面临的绝大多数问题都不是单一的“最好”,而是充满权衡与妥协的“最优”。记住,成功的建模不仅在于解出问题,更在于清晰地。 阅读详情

相关推荐

USB接口ESD保护电路:深度剖析与选型建议

USB接口在热插拔和频繁使用中极易遭遇静电放电(ESD)冲击,导致芯片损坏或通信异常。本文结合实际电路设计经验,详解TVS二极管、集成ESD防护器件等方案在USB接口上的应用要点,重点分析钳位电压、结电容、IEC 61000-4-2等级等关键参数对信号完整性与防护效果的影响,助你为USB接口匹配高可靠、低干扰的ESD保护方案。

weixin_36289813的博客 510

[洛谷P2745] [USACO5.3]窗体面积Window Area

洛谷题目链接:[USACO5.3]窗体面积Window Area 题目描述 你刚刚接手一项窗体界面工程。窗体界面还算简单,而且幸运的是,你不必显示实际的窗体。有 5 种基本操作: 创建一个新窗体 将窗体置顶 将窗体置底 删除一个窗体 输出窗体可见部分的百分比(就是,不被其它窗体覆盖的部分)。 在输入文件中,操作以如下的格式出现。 创建一个新窗体:w(I,x,y,X,Y) 将窗体置顶: t...

dengtun2502的博客 654

Xilinx Vitis arm-xilinx-eabi-gcc.exe: error: *.c: Invalid argument

This problem may be a bugof version 2021.1 only. Unfortunately, I'm just currently using this version. After Build Project: Find where this Makefile is through "make: Leaving directory" information. For me, it is located atZynq_CPU_wrapper_hw_platfo...

Ayka的博客 6661

[USACO5.3]Window Area【窗体面积】

这一道题没有想象中的那么难(1)建立窗用一个a数组来,a[][1]表示左上角的x坐标,a[][2]表示左上角的y坐标,a[][3]和a[][4]也是一样的a[head][]表示第head层的窗户坐标,记得是层(2)把窗户置顶把表示最高层的head+1,然后把当前的窗户放上去,在把以前的窗户删掉(3)把窗户置底把表示队尾tail--,再向(2)那样就可以了(4)求百分比dfs搜索,我们只用搜索比自己...

zsyzClb的博客 821

深入解析Transformer三大注意力机制:自注意力、交叉注意力与因果自注意力

注意力机制是深度学习中的核心概念,它模拟了人类在处理信息时选择性聚焦的能力。其基本原理是通过计算查询与键的相似度,动态地为值分配权重,从而提取关键信息。这一机制解决了传统序列模型(如RNN)难以并行化和捕获长距离依赖的痛点,技术价值在于显著提升了模型的计算效率和表征能力。在自然语言处理、计算机视觉等应用场景中,注意力机制已成为构建强大模型的基石。本文聚焦于Transformer架构中的三种核心注意力变体:自注意力用于建立序列内部的全局关联,交叉注意力连接编码器与解码器的信息,而因果自注意力则确保自回归生成的

weixin_29094775的博客 413

【RandLA-Net实战】从零构建隧道点云数据集并训练大场景语义分割模型

本文详细介绍了如何使用RandLA-Net构建隧道点云数据集并进行大场景语义分割模型训练。从数据采集、标注到模型训练与优化,提供了完整的实战指南,特别针对隧道场景的特殊挑战提出了解决方案。通过实际案例展示了RandLA-Net在处理大场景点云数据时的高效性和准确性,为隧道巡检等工程应用提供了可靠的技术支持。

weixin_30485379的博客 113

C++——【USACO 5.3.2】——Window Area

Window Area IV Balkan Olympiad You've just be assigned the project of implemented a windowing interface. This windowing interface is fairly simple, and fortunately, you don't have to display the a

McDonnell_Douglas的博客 561

风电光伏功率预测竞赛精华总结:技术解析与实战经验

本文深度解析新能源功率预测竞赛的技术要点与实战经验。首先介绍了风电、光伏功率预测对电网调度优化、降低运营风险的重要性,以及多个竞赛的基本概况。在数据特征分析部分,详细探讨了气象预报数据和功率数据的特征,包括时间周期性、数据质量问题及处理方法。针对异常值检测、数据标准化和特征工程(如时间特征、统计聚合特征、风速风向特征和滞后特征)提供了具体的技术实现方案。文章为新能源功率预测提供了实用的技术指导,对相关竞赛和实际应用具有重要参考价值。

算法工程师 206

[USACO5.3]窗体面积Window Area

https://www.luogu.org/problemnew/show/P2745 上浮法...真是奇特的方法 考虑到我们要把矩形置顶,那么如果我们置顶到第k层,现在摆在我们面前的是第k层的矩形 将矩形分为四个继续上浮即可 转载于:https://www.cnblogs.com/LM-LBG/p/10992892.html...

weixin_34415923的博客 252

零基础学习CANoe Panel(5)——改变变量的值,控件图像也改变,这是怎么回事?

Panel 中控件的图像随着值变化,是怎么回事?

蚂蚁小兵 2145

详细介绍用MATLAB实现基于A*算法的路径规划(附完整的代码,代码逐行进行解释)(一)--------A*算法简介和环境的创建

   本系列文章主要介绍基于A*算法的路径规划的实现,并使用MATLAB进行仿真演示。    一、 A*算法简介       A*(A-Star)算法是一种静态路网中求解最短路径最有效的直接搜索方法,也是解决许多搜索问题的有效算法。算法中的距离估算值与实际值越接近,最终搜索速度越快。      公式表示为: f(n)=g(n)+h(n),其中, f(n) 是从初始状态经由状态n到目标状态的代价估计,g(n) 是在状态空间中从初始状态到状态n的实际代价,h(n) 是从状态n到目标状态的最佳路径的估计代价。

慕羽★的博客 7万+

JZOJ1274.【USACO题库】2.4.4 Bessie Come Home回家

题目描述现在是晚餐时间,而母牛们在外面分散的牧场中。农民约翰按响了电铃,所以她们开始向谷仓走去。你的工作是要指出哪只母牛会最先到达谷仓(在给出的测试数据中,总会有且只有一只速度最快的母牛)。在挤奶的时候(晚餐前),每只母牛都在她自己的牧场上,一些牧场上可能没有母牛。每个牧场由一条条道路和一个或多个牧场连接(可能包括自己)。有时,两个牧场(可能是自我相同的)之间会有超过一条道路相连。至少有一个牧场和谷

路人黑的纸巾 1165

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

USACO5.3.2 Window Area(window)

对于创建,置顶,置底,删除一个窗体 ,很简单就不赘述了。重点在最后一问输出面积百分比,即矩形切割的题目。 所谓的矩形切割,矩形a与矩形b重叠,其中a在下面,b在上面,我们要知道a有多少面积可以被看见。其实就是用dfs的方法,在多个矩形重叠的情况下,一般先按重叠次序排一下序,然后从要询问的那个开始一次与他上面相邻的矩形比较,每次把不重叠的左边、右边、上边、下边一部分分别割成4个小矩形,然后每个小矩

xsy_victory的专栏 446

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

USACO5.3.2 Window Area (window)

矩形切割。 执行非查询操作时更新高度,创建窗体和置顶时时height[i]=top++,置底height[i]=bot--,删除窗体时vis[i]=false。 执行查询操作时dfs,每次用比窗口i高一层的窗体把i切割成最多4个矩形,然后递归。 这种方法叫上浮法,对于当前dfs的窗口i,想象它向上浮,遇上了第一个比它高的矩形,被它切成了最多4个矩形,然后4个小矩型再继续上浮,直到露出水面时剩

Shion的专栏 488

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

拆分-洛谷P2745 [USACO5.3]窗体面积Window Area

本来因为会WA的,结果AC了,啊哈哈哈哈哈哈哈哈哈 因为题目要求我们要把一个个平面有先后关系,那么我们就搞一个队列嘛,每次询问时,不断把平面上升就好了; 但是一个平面被另一个平面挡住一部分,剩下的可以简单得理解为4个部分: 上下左右 111122 111122 440022 440022 443333 443333 如图,大矩形被小矩形(以0表示),可以分为1 2 3 4 个部分

我怎么这么菜的呢 892

Usaco Training Section 5.3 Window Area

有一堆窗户,以及一些创建、置顶、置地、删除的操作,中间要询问几次某个窗户可见的百分比是多少。 对于创建、置顶、置地、删除的操作,直接模拟即可。主要是询问。 求可见百分比,要求出可见范围,也就是求被覆盖的面积,这是经典的矩阵覆盖。可用扫描线来实现。 懒得写线段树(貌似也并不需要),直接排序+推一推。 #include&lt;bits/stdc++.h&gt; #define ll lo...

Monster的博客 257

USACO 5.3 Window Area (矩形切割,上浮法)

2015-03-3021:03:02 思路:这道题... 不太好用扫描线来做...   我们给每个矩形一个优先级,越上面的优先级越高,由于同时存在添加、删除、置顶、置底多种操作,所以我们可以把优先级的初始值 赋值为一个较大的定值(不妨令为500),这么做的方便之处于,例如:对于第一次置底操作,我们可以让它的优先级=499,小于之前的所有矩形。   接着,对于每一个查看操作,可...

dingdi3021的博客 199

USACO 5.3 章节

相关讲解可在USACO上看原文,也可以搜索nocow找到翻译的! (nocow上有些微翻译是有问题的,如果想看nocow翻译的建议也对着英文看) 以下记录以下 自己之前未掌握的一些要点,以及按自己的括号表述的形式来记录。 USACO Section 5.3 启发式搜索 启发式搜索的主要思想是通过评价一个状态有"多好"来改进对于解的搜索. 0<= 可行的估价函数 <= 实际代价 启发式...

weixin_30745641的博客 383

USACO Section 5.3 Window Area - 又一矩形覆盖问题

最重要的问题..如何确定这些矩形的重叠层次顺序...我通过给每个矩形一个权值来表示当前矩形的优先级..只有当这个矩形某区域上有重合部分的矩形优先级都比这个矩形低..这个区域才说是从正面可以看到的面积...而这个优先级的操作:        用maxn表示当前优先级的最大值...用minn表示当前优先级的最小值..maxn与minn的初始值都为0..        当输入一个矩形..按题目的要求

zzyzzy12 1747

usaco 5.3 Window Area(模拟+矩形切割)

Window Area IV Balkan Olympiad You've just be assigned the project of implemented a windowing interface. This windowing interface is fairly simple, and fortunately, you don't have to display the act

志当存高远 1054

USACO 5.3 Window Area

Window AreaIV Balkan Olympiad You've just be assigned the project of implemented a windowing interface. This windowing interface is fairly simple, and fortunately, you don't have to display the ...

weixin_30783629的博客 182

USACO Window Area 解题报告

还是错了很多次。第一个想法是建立一个

thestoryofsnow的专栏 972

USACO SECTION 5.3 Window Area

Window Area IV Balkan Olympiad You've just be assigned the project of implemented a windowing interface. This windowing interface is fairly simple, and fortunately, you don't have to display the ac

350

USACO 5.3 Window Area(模拟)

坐标不全是左上角,右下角的。2Y,怎么可以写的这么麻烦。。。暴力水过。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: window 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include <cstring> 9 #i...

weixin_30545285的博客 143

luogu【P2745】[USACO5.3]窗体面积Window Area

这个题 就是个工程题 (然而一开始我并不知道怎么做。。还是看nocow的。。qwq)(原题入口) 算法为 离散化 + 扫描线 将大坐标变小 并且 用横纵坐标进行扫描 来计算面积 一开始 我想边添加 点的坐标 边 离散 后来发现 有点问题 因为 它离散后的坐标 并不是按顺序来排(因为后来可能还加入中间的点 就需要重新离散) 所以 我就把一开始的操作 和 坐标先存下来 进行离散 再进行...

weixin_30663471的博客 165
上一篇: usaco5.3.1 Milk Measuring
下一篇: usaco5.3.3 Network of Schools
max_kibble
博客等级 码龄11年 2粉丝 110原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值