String Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Problem DescriptionBob has a dictionary with N words in it.Now there is a list of words in which the middle part of the word has continuous letters disappeared.…
传送门 •参考资料 [1]:算法总结:[线段树+扫描线]&矩形覆盖求面积/周长问题(HDU 1542/HDU 1828) •题意 给你 n 个矩形,求矩形并的周长: •题解1(两次扫描线) 周长可以分成两部分计算,横线和竖线: 如何求解横线的所有并的长度呢? 和求矩阵面积并的做法一样,先将 x 离散化: 每次更新的时候,记录一下上次更新后的横线总长度: ans += [现在这次总区间被覆盖的长度和上一次总区间被覆盖的长度之差的绝对值]; 求解竖线的所有并的长度何求解横线的长度相同: 需要注意的是…
线段树扫描线矩形周长并 #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #define MAXN 22222 using namespace std; int len[MAXN<<2]; bool lbd[MAXN<<2],rbd[MAXN<<2]; int numseg[MAXN<<2]; int cnt[…
第一次做扫描线,然后使我对线段树的理解发生了动摇= =..这个pushup写的有点神奇.代码如下: #include <stdio.h> #include <algorithm> #include <string.h> #define t_mid (l+r>>1) #define ls (o<<1) #define rs (o<<1|1) #define lson ls,l,t_mid #define rson rs,t_mid+1,…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5091 Problem Description Recently, the γ galaxies broke out Star Wars. Each planet is warring for resources. In the Star Wars, Planet X is under attack by other planets. Now, a large wave of enemy spaces…
Atlantis Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11551    Accepted Submission(s): 4906 Problem Description There are several ancient Greek texts that contain descriptions of the fabled…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11558 Accepted Submission(s): 4910 Problem Description There are several ancient Greek texts that contain descriptions of the fabled island Atlantis…
Picture Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4475    Accepted Submission(s): 2207 Problem Description A number of rectangular posters, photographs and other pictures of the same shap…
传送门 •题意 给你 n 矩形,每个矩形给出你 $(x_1,y_1),(x_2,y_2)$ 分别表示这个矩形的左下角和右上角坐标: 让你求这 n 个矩形并的面积: 其中 $x \leq 10^{5} \ ,\ y \leq 10^{5}$; •题解 这类题的解决方法需要用到一个比较重要的算法--扫描线算法: 其实并不需要将扫描线算法学的多么透彻,此类题仅仅用到了扫描线算法的思想: 下面开始说说如何用扫描线处理这类问题: 假设你有两个矩形,如图所示: 矩形①的左下角和右上角坐标分别为:$(1.2\…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3265 题意:给你一张挖了洞的墙纸贴在墙上,问你总面积有多少. 挖了洞后其实就是多了几个矩形墙纸,一张墙纸挖了洞后可以分成4个小矩形至于怎么分看个人喜好,然后再求个矩形的面积并 要注意的是x1==x3||x2==x4||y1==y3||y2==y4时不用分矩形这是个小小的优化. #include <iostream> #include <cstring> #include <alg…