码迷,mamicode.com
首页 >  
搜索关键字:成段更新    ( 146个结果
poj 3468 A Simple Problem with Integers
线段树成段更新,成段求和 开始没有注意到更新的值可以是负数,结果吧标记初始化为-1,wa到死 #include #include #define maxn 111111 #define ll long long using namespace std; ll num[maxn]; int n,m; string cmd; int a,b,k; struct stu { int l,r,m...
分类:其他好文   时间:2015-08-16 16:44:19    阅读次数:102
poj 3468 A Simple Problem with Integers (线段树成段更新)
A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 77486   Accepted: 23862 Case Time Limit: 2000MS Description You have...
分类:其他好文   时间:2015-08-15 00:13:25    阅读次数:135
hdu 1698 Just a Hook
线段树成段更新,设置延迟标记,很好的方法,想出这个方法的人确实很吊 注意细节,有些小地方错了真的很难发现~ #include #define maxn 111111 using namespace std; int n,a,b,m; struct stu { int l,r,sum,flag; }; stu mapp[maxn*4]; void build(int l,int r,int c...
分类:其他好文   时间:2015-08-12 19:40:25    阅读次数:107
HDU 3397 Sequence operation(线段树·成段更新·区间合并·混合操作)
题意  给你一个只有0, 1的数组  有这些操作   0. 将[a, b]区间的所有数都改为0   1. 将[a, b]区间的所有数都改为1   2. 将[a, b]区间的所有数都取反 即与1异或   3. 输出区间[a, b]中1的个数  即所有数的和   4. 输出区间[a, b]中最大连续1的长度 对于所有的3, 4操作输出对应的答案 单个的操作都很简单  但搞在一起就...
分类:其他好文   时间:2015-08-12 11:42:56    阅读次数:131
HDU 1698 Just a Hook(线段树lazy成段更新)
Just a HookProblem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up o...
分类:其他好文   时间:2015-08-06 22:02:40    阅读次数:166
HDU 3966 RE 树链剖分 Aragorn's Story
给一棵点带权的图有这样一个操作:使树上某一条路径所有点权值增减每次询问某个点现在的权值。树链剖分完以后,就是线段树的成段更新了。这题感觉A不了了,无限RE,手动开栈也没卵用。还是把我辛辛苦苦写的代码贴一下吧。 1 #include 2 #include 3 #include 4 #in...
分类:其他好文   时间:2015-08-06 14:47:52    阅读次数:139
codeforces 558EA Simple Task
开始试想直接用容器来暴力做,,,,,, 恩。。。。。线段树。。。。 记不得以前写没写过了,,,, 先来个模板先(就是那种n个询问成段更新的题) #include #include #include #include using namespace std;        #define lson l , m , rt #define rson m + 1 , r ...
分类:其他好文   时间:2015-08-03 10:10:15    阅读次数:124
HDU4027——线段树成段更新——Can you answer these queries?
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Ea...
分类:其他好文   时间:2015-08-02 21:29:51    阅读次数:128
zoj 1610 Count the Colors
题意给0-8000区间染色,最后有多少个颜色区间,并且出现了多少次思路线段树成段更新 注意点: 就是 1-2 1 3-4 1 并不是连接在一起的是两段 所以我们可以在更新的时候使 l=l+1 这样就是两段了 代码 还是很简单的代码/* ********************************************** Auther: 请叫我acm渣渣 Created...
分类:其他好文   时间:2015-07-29 21:22:34    阅读次数:92
POJ-2585-Mayor's posters-成段更新+(hash)离散化思想
题目链接:http://poj.org/problem?id=2528 #include #include #include #include #include #include #include #include #include #include #include #define LL long long using namespace std; // 照着题目数组开10005,给报RE,...
分类:其他好文   时间:2015-07-28 00:58:08    阅读次数:120
146条   上一页 1 ... 4 5 6 7 8 ... 15 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!