![]() |
||||||||||
|
||||||||||
To the moonTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 17473 Accepted Submission(s): 4060 Problem Description 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 man. In this problem, we'll give you a chance, to implement the logic behind the scene. You‘ve been given N integers A[1], A[2],..., A[N]. On these integers, you need to implement the following operations: 1. C l r d: Adding a constant d for every {Ai | l <= i <= r}, and increase the time stamp by 1, this is the only operation that will cause the time stamp increase. 2. Q l r: Querying the current sum of {Ai | l <= i <= r}. 3. H l r t: Querying a history sum of {Ai | l <= i <= r} in time t. 4. B t: Back to time t. And once you decide return to a past, you can never be access to a forward edition anymore. .. N, M ≤ 105, |A[i]| ≤ 109, 1 ≤ l ≤ r ≤ N, |d| ≤ 104 .. the system start from time 0, and the first modification is in time 1, t ≥ 0, and won't introduce you to a future state. Input n m A1 A2 ... An ... (here following the m operations. ) Output ... (for each query, simply print the result. ) Sample Input
Sample Output
Author HIT Source | ||||||||||
|