码迷,mamicode.com
首页 >  
搜索关键字:线段树    ( 9365个结果
POJ 3667 Hotel.
~~~~ 线段树区间合并~ 两种操作: 1、输出满足连续区间最左边的值。 2、更新一段连续区间。 题目链接:http://poj.org/problem?id=3667 ~~~~ #include #include #include #define INF 0x7fffffff #define lson rt<<1,s,m #define rson rt<<1|1,m+1,e #de...
分类:其他好文   时间:2014-08-12 00:48:13    阅读次数:166
POJ 2528 Mayor's posters.
~~~~ 一直MLE,才发现要写离散化操作。其他就是线段树的成段更新(每次用不同标记去更新区间),最后统计下有多少种标记就OK了。 题目链接:http://poj.org/problem?id=2528 大牛写的很详细,请戳:http://blog.csdn.net/metalseed/article/details/8041334 ~~~~ #include #include #inc...
分类:其他好文   时间:2014-08-11 21:34:43    阅读次数:268
POJ训练计划2828_Buy Tickets(线段树/单点更新)
解题报告 题意: 插队完的顺序。 思路: 倒着处理数据,第i个人占据第j=pos[i]+1个的空位。 线段树维护区间空位信息。 #include #include #include using namespace std; struct node { int x,v; } num[201000]; int sum[1000000],ans[201000]; void c...
分类:其他好文   时间:2014-08-11 21:34:33    阅读次数:378
bnu36905 Nested Segments 离散化+线段树
bnu36905 Nested Segments 离散化+线段树区间更新 也可以用离散化+set(或双向链表) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #...
分类:其他好文   时间:2014-08-11 21:31:03    阅读次数:239
bnu36907 Subpalindromes 字符串hash+线段树
bnu36907 Subpalindromes 字符串hash+线段树 题意:给一个字符串( 1)将指定位置的字符改为c 2)询问l-r的子串,是否是回文串。 解法 :区间维护pl和pr,表示从左到右的hash和从右到左的hash,然后在up和query中合并区间,最后判断pl和pr是否相等即可。 #include #include #include #include #inc...
分类:其他好文   时间:2014-08-11 21:29:52    阅读次数:301
UVA - 11983 Weird Advertisement (线段树求并面积)
Description G Weird Advertisement Renat Mullakhanov (rem), one of the most talented programmers in the world, passed away on March 11, 2011. This is very sad news for al...
分类:其他好文   时间:2014-08-11 21:27:52    阅读次数:261
线段树模板(结构体)
线段树研究了两天了,总算有了点眉目,今天也把落下的题,补了一下。 贴一份线段树模板 线段树的特点: 1. 每一层都是区间[a, b]的一个划分,记 L = b - a 2. 一共有log2L层 3. 给定一个点p,从根到叶子p上的所有区间都包含点p,且其他区间都不包含点p。 4. 给定一个区间[l; r],可以把它分解为不超过2log2 L条不相交线段的并。 总结来说:...
分类:其他好文   时间:2014-08-11 21:22:22    阅读次数:528
poj3277--City Horizon(线段树+离散化+扫描线)
City Horizon Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 16206   Accepted: 4414 Description Farmer John has taken his cows on a trip to the city! As the ...
分类:其他好文   时间:2014-08-11 21:19:42    阅读次数:339
FZU_Problem 2171 防守阵地 II
http://acm.fzu.edu.cn/problem.php?pid=2171 线段树模板题,成段增减,区间求和。 思路:先查询,后更新。   #include #define lson l , m ,rt << 1 #define rson m+1 , r , rt << 1 | 1 const int maxn = 100002; int add[maxn << 2]; in...
分类:其他好文   时间:2014-08-11 18:01:42    阅读次数:214
poj1151-- Atlantis(线段树+离散化+扫描线)
Atlantis Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Submit Status   Description There are several ancient Greek texts that contain descriptions of ...
分类:其他好文   时间:2014-08-11 17:51:13    阅读次数:261
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!