上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 20 下一页

2014年8月21日

Hdu3397Sequence operation线段树

摘要: 这题不得不吐槽下了,这是我没有搜题解1a的题,让我又有继续做线段树的动力。几个东西揉在一块。#include #include #include #include #include #include #include #include #include #include #include #in... 阅读全文

posted @ 2014-08-21 23:01 一个西瓜 阅读(157) 评论(0) 推荐(0)

Hdu3308LCIS线段树

摘要: 区间合并,和hotel那题差不多,只不过在合并区间的时候加和条件,变成左右儿子相连处是否上升,并且,对父亲的更新取得是最大值。#include #include #include #include #include #include #include #include #include #inclu... 阅读全文

posted @ 2014-08-21 23:00 一个西瓜 阅读(212) 评论(0) 推荐(0)

Poj3667Hotel线段树

摘要: 区间合并。需要记录三个东西,sum[rt] 表示这个区间最长连续空集的长度,lsum[rt]=表示从左边开始最长连续空集的长度,rum[rt]表示从右边最长连续空集的长度。#include #include #include #include #include #include #include #... 阅读全文

posted @ 2014-08-21 22:59 一个西瓜 阅读(168) 评论(0) 推荐(0)

Poj1436Horizontally Visible Segments线段树

摘要: 这题拆点搞。比如 [1,2] [3,4] 这两段,可以有 2.2之类的点能使一条线射穿它,但是2.2这种点整数线段上搞不出来,然后就把2*2=4 ,3*2=6;这样新的线段就可以覆盖到他穿到能与他直线相连的线段上,记录下,然后三个for 枚举答案。#include #include #include... 阅读全文

posted @ 2014-08-21 22:57 一个西瓜 阅读(198) 评论(0) 推荐(0)

Poj3225Help with Intervals区间线段树

摘要: 这题不说了,都是泪。这题拆点。开始很戳的把更新分开成一部分写,然后一直re。。后来学了这种直接在更新里把所有的搞了的搞法,愈发的感觉自己蠢了。先说下题意:将一个集合经过并交补 ,然后求最后的集合。搞法:U [l,r] 将[l,r] 置为1 D [l,r] 将[l,r] 置为0 S [... 阅读全文

posted @ 2014-08-21 22:55 一个西瓜 阅读(174) 评论(0) 推荐(0)

Poj2528Mayor's posters线段树

摘要: 离散化搞下。就是8 9 19 分别映射到 1 2 3 上。用map好像会超时,可能自己写戳了。#include #include #include #include #include #include #include #include #include #include #include #i... 阅读全文

posted @ 2014-08-21 22:52 一个西瓜 阅读(121) 评论(0) 推荐(0)

poj3468A Simple Problem with Integers区间和线段树

摘要: 同上。。。#include #include #include #include #include #include #include #include #include #include #include #include #includeusing namespace std;typedef l... 阅读全文

posted @ 2014-08-21 22:49 一个西瓜 阅读(163) 评论(0) 推荐(0)

Hdu1698Just a Hook线段树区间更新

摘要: 区间更新基础。。不说了,也是照着notonlysuccess的博客撸的。#include #include #include #include #include #include #include #include #include #include #include #include usin... 阅读全文

posted @ 2014-08-21 22:47 一个西瓜 阅读(136) 评论(0) 推荐(0)

Poj2886Who Gets the Most Candies?线段树

摘要: 约瑟夫环用线段数搞,一脸搞不出来的样子。反素数,太神了,先打表,然后就可以 O(1)找到因子数最多的。ps:哎。这题也是看着题解撸的。#include #include #include #include #include #include #include #include #include #i... 阅读全文

posted @ 2014-08-21 22:45 一个西瓜 阅读(126) 评论(0) 推荐(0)

Poj2828Buy Tickets线段树

摘要: 倒着搞就可以了,先进会被后面覆盖。#include #include #include #include #include #include #include #include #include #include #include #include #includeusing namespace... 阅读全文

posted @ 2014-08-21 22:40 一个西瓜 阅读(197) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 20 下一页

导航