Old MacDonald has a farm and a large potato field, (1010 + 1) × (1010 + 1) square meters in size. The field is divided into square garden beds, each bed takes up one square meter. Old McDonald knows that the Colorado potato beetle is about to invade…
题意: 一个人在一张大图上走,给你路径与起点,求他走出的矩形面积并.(大概这个意思自行百度标题... SOL: 与其说这是一道图论题不如说是一道生动活泼的STL-vector教学.... 离散化宽搜,没什么别的...vector用得淋漓尽致... Code: /*========================================================================== # Last modified: 2016-03-18 08:32 # Filenam…
Coconuts Time Limit: 9000/4500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 524    Accepted Submission(s): 151 Problem Description TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams abou…
题目传送门 /* 题意:问一个点到另一个点的最少转向次数. 坐标离散化+BFS:因为数据很大,先对坐标离散化后,三维(有方向的)BFS 关键理解坐标离散化,BFS部分可参考HDOJ_1728 */ #include <cstdio> #include <algorithm> #include <cstring> #include <queue> #include <vector> #include <map> #include <…
Problem Description Terrorists put some mines in a crowded square recently. The police evacuate all people in time before any mine explodes. Now the police want all the mines be ignited. The police will take many operations to do the job. In each ope…
A. Dividing Orange 模拟. B. Undoubtedly Lucky Numbers 暴力枚举\(x.y\). C. The Brand New Function 固定左端点,右端点右移时,\(f(l,r)\)是递增的,并且最多\(\log{10^6}\)种值. D. Hydra 枚举边,每个端点最多枚举\(h+t+1\)个点. E. Colorado Potato Beetle 考虑压缩整个网格. 离散的图为\(3n\cdot 3n\),然后bfs即可.…
因为只有1e5个点,所以直接离散化bfs就好 #include <cstdio> #include <cstring> #include <queue> #include <set> #include <map> #include <stack> #include <cstdlib> #include <algorithm> #include <vector> #include <cmath&…
//这题从十一点开始写了四十分钟 然后查错一小时+ 要吐了 这题题意是给很多矩形的左下角(x,y,z最小的那个角)和三边的长(不是x,y,z最大的那个角T-T),为组成图形的面积与表面积(包在内部的之算体积不算表面积) 解法:离散化+bfs,先把范围扩大(相当于在周围加上空气),然后bfs,遇到表面积直接加入,遇到非长方体的部分也直接加入,最后用总体积减去空气的体积,这样就可以把内部的体积计算进来而不计算其表面积.因为坐标范围比较大,要先离散化. //其实我对这题一直耿耿于怀,当年没进省队多少与…
https://vjudge.net/problem/UVA-12171 题目 某人设计雕塑,用的是很扯的方法:把一堆长方体拼起来.给出长方体的坐标和长宽高,求外表面积.因为要将这雕塑进行酸洗,需要知道$V_排$ 输入长方体信息,输出外表面积和$V_排$ \[0\le 每个维度的坐标值\le 500\] \[0\le长.宽.高 \le500\] (不会描述了) 题解 有了紫书上的提示,还是写了两个小时…… 离散化+bfs 将长方体出现的坐标都存入数组,然后排序,然后使用 unique 函数, u…
Walk Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1142    Accepted Submission(s): 195 Problem Description Biaoge is planning to walk to amusement park. The city he lives can be abstracted as…