题目链接线段树掌握的很差,打算从头从最简单的开始刷一波, 嗯。。就从这个题开始吧! 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 const int maxn = 50000+10; 8 using...
分类:
其他好文 时间:
2014-08-04 20:49:57
阅读次数:
343
题目大意:往一面墙上贴与墙等高的海报,n次贴完后,求可以看见的海报总数(看见一部分也算)思路:明显的区间维护,用线段树,不过裸的线段树超时超空间,可以把坐标离散,得到不超过200000个有效点,每个点都表示一个小区间(a[i]~a[i+1]这一段),然后就可以轻松地解决了。不过题目有个坑,给定的右坐...
分类:
其他好文 时间:
2014-08-04 20:47:37
阅读次数:
369
Description
N children are sitting in a circle to play a game.
The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. The ...
分类:
其他好文 时间:
2014-08-04 17:57:27
阅读次数:
284
Description
ACM has bought a new crane (crane -- je?áb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th segment is joined to the beginning o...
分类:
其他好文 时间:
2014-08-04 17:55:37
阅读次数:
240
题目链接:点击打开链接
题意:n长的序列(初始全为0) m个操作 k个查询
下面m个操作[l,r] h 代表 a[l] +=h; a[l+1] += h+i; a[l+i] += h+i; l
然后问k个位置的和
因为k
-----------------------
如果k
只需要给区间记录一个标记lazy,表示从左端点开始 l, l+1, l+i ··· l+r
而向下更新时...
分类:
其他好文 时间:
2014-08-04 17:40:57
阅读次数:
186
Who Gets the Most Candies?Time Limit: 5000 MS Memory Limit: 0 KB64-bit integer IO format: %I64d , %I64u Java class name: Main[Submit] [Status] [Discus...
分类:
其他好文 时间:
2014-08-04 17:13:47
阅读次数:
307
Luck and LoveTime Limit: 10000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5262Accepted Submission(s): 1317Prob...
分类:
其他好文 时间:
2014-08-04 14:10:27
阅读次数:
341
http://poj.org/problem?id=2155
Matrix
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 18143
Accepted: 6813
Description
Given an N*N matrix A, ...
分类:
其他好文 时间:
2014-08-04 10:59:47
阅读次数:
269
HDU 4006 The kth great number (基本算法-水题)
题目大意:
有m组操作,求第K大数。I为insert操作,即插入1个数,Q为询问,输出此时的第K大数。
解题思路:
一道水题让我智商捉鸡了,居然笨到想去用线段树去做。后来发现1个set搞定,就存K个大数,超过的把小的踢掉,输出第一个即可。...
分类:
其他好文 时间:
2014-08-03 23:19:36
阅读次数:
287
HDU 4007 Dave (基本算法-水题)
题目大意:
告诉你n个点,再告诉你正方形边长,问你这个正方形最多包含多少个点?
解题思路:
先枚举x在范围内的点,O(n)的效率,然后对x在范围的点中,找出y在范围内的点,这个考虑到n不是很大,排序找出最大的即可,否则要用到线段树。...
分类:
其他好文 时间:
2014-08-03 23:17:36
阅读次数:
398