Mayor's posters POJ - 2528】的更多相关文章

Mayor's posters Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 74745   Accepted: 21574 Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral post…
链接: http://poj.org/problem?id=2528 覆盖问题, 要从后往前找, 如果已经被覆盖就不能再覆盖了,否则就可以覆盖 递归呀递归什么时候我才能吃透你 代码: #include<stdio.h> #include<algorithm> #include<stdlib.h> #include<string.h> using namespace std; #define Lson r<<1 #define Rson r<…
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally decided to build an electoral wall for placing the…
题意 贴海报 最后可以看到多少海报 思路 :离散化大区间  其中[1,4] [5,6]不能离散化成[1,2] [2,3]因为这样破坏了他们的非相邻关系 每次离散化区间 [x,y]时  把y+1点也加入就行了 注:参考了上海全能王csl的博客! #include<cstdio> #include<algorithm> #include<set> #include<vector> #include<cstring> #include<iostr…
//线段树区间覆盖 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; ; int flag; struct node{ int l,r; //vis 是这块区域是否完全被覆盖 bool vis; }tr[N<<]; struct point { int id; int x; }post[N<<];…
题意:输入t组数据,输入n代表有n块广告牌,按照顺序贴上去,输入左边和右边到达的地方,问贴完以后还有多少块广告牌可以看到(因为有的被完全覆盖了). 思路:很明显就是线段树更改区间,不过这个区间的跨度有点大(看数据),不过n<10000,所以就可以把这些广告牌的边界重新定义编号,比如: n输入 2 1 6 2 13 排序以后,1还是1,2还是2,6就可以看成3,13就可以看成4 变成: 1 3 2 4 其实性质还是没有变,两个广告牌都可以看到,不过线段树开的数组就不用很大了. #include<…
甚至DFS也能过吧 Mayor's posters POJ - 2528 The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally decided to bui…
D - Mayor's posters POJ - 2528 思路:线段树+离散化. 离散化时注意特殊情况,如果两个数相差大于一,离散时也应该差1.比如 1 3 离散后应该为 1 2. 错因: 1.二分时出现错误,,zz  zz  Orz 2. if(tree[now].l==tree[now].r) return ; 这句话漏了.   Orz          还要注意这句话的位置. #include<cstdio> #include<cstring> #include<i…
Mayor's posters POJ 2528 传送门 线段树区间修改加离散化 #include <cstdio> #include <iostream> #include <queue> #include <cmath> #include <algorithm> #include <cstring> using namespace std; #define ll long long #define P pair<int,in…
G - Mayor's posters POJ - 2528 这个题目要倒着来写,从后面往前面贴,因为前面的有些会被后面的覆盖. 所以我们就判断这张海报的位置有没有完全被覆盖,如果完全被覆盖了就不能贴,但是没有完全被覆盖就可以贴上去,然后更新掉这一段. #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #incl…