Ignatius and the Princess I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17930    Accepted Submission(s): 5755Special Judge Problem Description The Princess has been abducted by the BEelzebub…
扫描线求周长: hdu1828 Picture(线段树+扫描线+矩形周长) 参考链接:https://blog.csdn.net/konghhhhh/java/article/details/78236036 假想有一条扫描线,从左往右(从右往左),或者从下往上(从上往下)扫描过整个多边形(或者说畸形..多个矩形叠加后的那个图形).如果是竖直方向上扫描,则是离散化横坐标,如果是水平方向上扫描,则是离散化纵坐标.下面的分析都是离散化横坐标的,并且从下往上扫描的. 扫描之前还需要做一个工作,就是保存…
Ignatius and the Princess IV  先搬中文 Descriptions:   给你n个数字,你需要找出出现至少(n+1)/2次的数字 现在需要你找出这个数字是多少? Input 本题包含多组数据,请处理到EOF: 每组数据包含两行. 第一行一个数字N(1<=N<=999999) ,保证N为奇数. 第二行为N个用空格隔开的整数. Output 对于每组数据,输出一行,表示要求找到的那个数 Sample Input 5 1 3 2 3 3 11 1 1 1 1 1 5 5…
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25929    Accepted Submission(s): 17918 Problem Description "Well, it seems the first problem is too easy. I will let…
题目链接 Problem Description Given the finite multi-set A of n pairs of integers, an another finite multi-set B of m triples of integers, we define the product of A and B as a multi-set C=A∗B={⟨a,c,d⟩∣⟨a,b⟩∈A, ⟨c,d,e⟩∈B and b=e} For each ⟨a,b,c⟩∈C, its B…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1010 Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 144191    Accepted Submission(s): 38474 Problem Description The doggie fou…
Ignatius and the Princess I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11710    Accepted Submission(s): 3661 Special Judge Problem Description The Princess has been abducted by the BEelzeb…
题意:在一张无向图上,已知边权,做q组询问,问小于L的点对共有几组.点对间的距离取=min(两点之间每一条通路上的最大值). 分析:这里取最大值的最小值,常用到二分.而这里利用离线算法,先对边从小到大排序,逐一加入集合中.利用并查集,当两点之间不在同一个集合,那么所加入的边就是两个集合中任一点对的距离(两集合各取一点).所以有cnt2+=num[fu]*num[fv]; 注意:有些询问比m条边中的最小边还小,比最大边还大. #include<cstdio> #include<cstrin…
During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except the two at the ends, every village was directly con…
dfs通过递归将每种情景分割在不同的时空,但需要对每种情况对后续时空造成的痕迹进行清理(这是对全局变量而言的,对形式变量不需要清理(因为已经被分割在不同时空)) bfs由于不是利用递归则不能分割不同的时空,但其利用队列将不同时空下的步骤在时间上进行同步(但队列内部的并不都是同一时间的) 但必须要区分在队列内的与从队列里拿出来的时间关系,所以对于类似于取钥匙开门的操作,应该判定在钥匙位置被提出队列时才能触发开门功能,而不能认为钥匙在队列时就能开门也就是bfs的作用效果要放在位置被提出队列时展开,而…