poj 2528】的更多相关文章

Mayor's posters Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2528 Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been plac…
/* poj 2528 Mayor's posters 线段树 + 离散化 离散化的理解: 给你一系列的正整数, 例如 1, 4 , 100, 1000000000, 如果利用线段树求解的话,很明显 会导致内存的耗尽.所以我们做一个映射关系,将范围很大的数据映射到范围很小的数据上 1---->1 4----->2 100----->3 1000000000----->4 这样就会减少内存一些不必要的消耗 建立好映射关系了,接着就是利用线段树求解 */ #include<ios…
Mayor's posters Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 59239   Accepted: 17157 Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral post…
poj 2528 Mayor's posters 题目链接: http://poj.org/problem?id=2528 思路: 线段树+离散化技巧(这里的离散化需要注意一下啊,题目数据弱看不出来) 假设给出: 1~10 1~4 7-10 最后可以看见三张海报 如果离散化的时候不注意,就会变成 1 4 7 10(原始) 1 2 3 4 (离散化) 转化为: 1~4 1~2 3~4 这样的话最后只能看见两张海报 解决办法,如果原数据去重排序后相互之间差值大于1,则在他们之间再插入一个数值,使得大…
poj 2528 For each input data set print the number of visible posters after all the posters are placed. The picture below illustrates the case of the sample input.  Sample Input 1 5 1 4 2 6 8 10 3 4 7 10 Sample Output 4 题意:贴报纸,可以互相覆盖,求最后能看见多少. 数据很大,不离…
POJ - 2528 Mayor's posters 思路:分治思想. 代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; #define ll long long #define ls rt<<1,l,m #define rs rt<<1|1,m+1,r #define pb push_back const int INF=0x3f3f3f…
POJ.2528 Mayor's posters (线段树 区间更新 区间查询 离散化) 题意分析 贴海报,新的海报能覆盖在旧的海报上面,最后贴完了,求问能看见几张海报. 最多有10000张海报,海报左右坐标范围不超过10000000. 一看见10000000肯定就要离散化了,因为建树肯定是建不下.离散化的方法是:先存到一个数组里面,然后sort,之后unique去重,最后查他离散化的坐标lower_bound就行了.特别注意如果是从下标为0开始存储,最后结果要加一.多亏wmr神犇提醒. 这题是…
Mayor's posters Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2528 Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been plac…
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…
题目链接:http://poj.org/problem?id=2528 题目大意:有一个很上的面板, 往上面贴海报, 问最后最多有多少个海报没有被完全覆盖 解题思路:将贴海报倒着想, 对于每一张海报只需要判断他要贴的位置是否已经全部被之前的海报覆盖就可以了, 如果没有被覆盖那么这个海报最后是没有被完全覆盖的, 如果被覆盖了, 那么最后是被完全覆盖的.标准的线段树题目. 代码如下: #include<stdio.h> #include<vector> #include<map&…