HDU 4348 I - To the moon 可持续化】的更多相关文章

队友套的可持续化线段树,徘徊在RE和MLE之间多发过的... 复用结点新的线段树平均要log2N个结点. 其实离线就好,按照时间顺序组织操作然后dfs. #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <cmath> #include <vector> using namespace std; ; int n,…
BUPT2017 wintertraining(15) #8G 题意 给一个数组a,有n个数,m次操作.\(N, M ≤ 10^5, |A i| ≤ 10^9, 1 ≤ l ≤ r ≤ N, |d| ≤ 10^4\) 操作有四种, C l r d:更新区间[l,r],值都加上d,并且时间前进1 Q l r:查询[l,r]的区间和 H l r t:查询t时刻的区间和 B t:回到t时刻(一定是历史时刻),且t时刻之后的操作都作废了. 题解 这道题的关键是怎么更新区间和. 本来线段树更新区间和要pu…
版权声明:本文为博主原创文章,未经博主允许不得转载. hdu 4348 题意: 一个长度为n的数组,4种操作 : (1)C l r d:区间[l,r]中的数都加1,同时当前的时间戳加1 . (2)Q l r:查询当前时间戳区间[l,r]中所有数的和 . (3)H l r t:查询时间戳t区间[l,r]的和 . (4)B t:将当前时间戳置为t . 所有操作均合法 . 解法: 很明显是一道主席树的题 . 对于每一次区间加法都新建节点建一棵线段树,加个懒惰标记就行了,查询的话直接线段树区间求和 .…
To the moon Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 8372    Accepted Submission(s): 1986 Problem Description BackgroundTo The Moon is a independent game released in November 2011, it is…
链接: http://acm.hdu.edu.cn/showproblem.php?pid=4348 题意: 4种操作: C l r c   区间[l,r]加c,时间+1 Q l r    询问当前时间区间[l,r]的和 H l  r c  询问在时间t时,区间[l,r]的和 B x  回到时间x 思路: 涉及历史版本的询问,很容易想到主席树,然后尝试用线段树的思路用主席树写了下,疯狂WA,TLE,后面看了下其他人的博客....发现不能加pushdown操作,因为一般来说pushdown更新完当…
http://acm.hdu.edu.cn/showproblem.php?pid=4348 以前做的主席树没有做过在线修改的题做一下(主席树这种东西正经用法难道不是在线修改吗),标记永久化比较方便. 前面眼瞎爆了一次空间改过来之后交第二次奇迹一样a了,好久没有1A过了(泪). #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath…
Vjudge题面 Time limit 2000 ms Memory limit 65536 kB OS Windows Source 2012 Multi-University Training Contest 5 SPOJ原版题面 Background To The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker. Th…
To the moon Problem Description BackgroundTo The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker.The premise of To The Moon is based around a technology that allows us to permanently reco…
To the moonTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88748#problem/I Description To The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG…
Background To The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker. The premise of To The Moon is based around a technology that allows us to permanently reconstruct the memory on dying ma…