这个题意是市长竞选,然后每个人都可以贴广告牌。可以覆盖别人的看最后剩几个广告牌
这题目想了两个多小时,最后忍不住看了一下题解。发现只是简单地hash 和线段树成段更新
因为有10000个人竞选,所以最多是10000个区间。20000个点,线段树就不会爆内存了;
具体操作有两个:
(1)哈希之后把每个区间端点当做底层节点,并且只要是把这个节点染色之后就是把这两个节点之中的全染色了
(2)...
分类:
其他好文 时间:
2014-10-02 21:59:33
阅读次数:
161
题意:有t组测试数据,有n张海报,海报按题目给出的顺序覆盖,问最后能看到几张海报。这道题刚开始没想出来,,最后看的题解,,从最后一张海报开始处理 一下子就明白了。线段树区间更新搞之。(当然离散化是必须的)预处理区间所有值都置0,然后从最后面开始,每次求 l[i] ~r[i]区间的和,如果小于r[i]...
分类:
其他好文 时间:
2014-09-25 03:26:18
阅读次数:
285
需要离散化处理,线段树的区间修改问题。
需要注意的就是离散化的时候,由于给的数字是一段单位长度,所以需要特殊处理(因为线段的覆盖和点的覆盖是不一样的)
比如:(1,10)(1,4) (6,10)
离散化之后是 1 , 4 , 6 , 10 分别离散为 1 2 3 4
覆盖的时候先覆盖1 4 之后覆盖了1 2 之后覆盖了 2 3,结果为2
但是实际上应该是3
134503...
分类:
其他好文 时间:
2014-09-17 16:52:37
阅读次数:
161
题意:高度为1byte的n(n 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define lson l, m, rt arr; 16 vector sor; 17 int lazy[...
分类:
其他好文 时间:
2014-09-06 17:18:33
阅读次数:
253
Mayor's posters
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 42808
Accepted: 12481
Description
The citizens of Bytetown, AB, could not stand that the ca...
分类:
其他好文 时间:
2014-08-29 14:41:48
阅读次数:
179
先贴,明天再补。#include #include #include #include #include #include #include #include #include #include #include #include #includeusing namespace std;#def.....
分类:
其他好文 时间:
2014-08-22 00:09:45
阅读次数:
167
题意:不讲了,线段树离散化的入门题。之所以贴出来只为吐槽几个地方:1.最后统计颜色的时候,试了好几种方法都TLE,反正用vis就TLE,不知道别人的怎么行,最后没办法,学了网上一个机智的做法:用set记录ans个数,最后过了。2.数据不对,离散化的时候如果排完序后相邻的元素值不相邻的话,是不能离散为...
分类:
其他好文 时间:
2014-08-21 22:28:04
阅读次数:
264
解题报告
题意:
给定的矩形里面有镂空的矩阵,求矩阵面积并。
思路:
直接把一个图形拆成4个矩形,进行面积并。
扫描线+线段树
#include
#include
#include
#include
#define LL __int64
using namespace std;
struct Seg
{
int lx,rx,h,v;
friend bool op...
分类:
其他好文 时间:
2014-08-16 21:10:41
阅读次数:
207
Description
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 counci...
分类:
其他好文 时间:
2014-08-16 13:53:40
阅读次数:
679
Description
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 coun...
分类:
其他好文 时间:
2014-08-14 16:46:38
阅读次数:
291