{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv id\u003d\"problem-body\"\u003e \n \u003ch3\u003eBackground\u003c/h3\u003e \n \u003cp\u003e\u003cem\u003eTo The Moon\u003c/em\u003e is a \u003ca href\u003d\"https://www.igf.com/\"\u003eindependent\u0026nbsp;game\u003c/a\u003e\u0026nbsp;released in November 2011, it is a role-playing adventure game powered by\u0026nbsp;\u003ca title\u003d\"RPG Maker\" href\u003d\"https://en.wikipedia.org/wiki/RPG_Maker\"\u003eRPG Maker\u003c/a\u003e.\u003c/p\u003e \n \u003cp style\u003d\"text-align: center;\"\u003e\u003cimg title\u003d\"River \u0026amp;\u0026amp; Anya .. .\" SRC\u003d\"CDN_BASE_URL/3ee11e5de551862f94d26331805bf5e5?v\u003d1543721332\" alt\u003d\"River \u0026amp;\u0026amp; Anya .. .\" width\u003d\"640\" height\u003d\"480\"\u003e\u003c/p\u003e \n \u003cp\u003eThe premise of \u003cem\u003eTo The Moon\u003c/em\u003e is based around a technology that allows us to permanently reconstruct the memory on dying man. In this problem, we\u0027ll give you a chance,\u0026nbsp;to implement the logic behind the scene.\u003c/p\u003e \n \u003ch3\u003eDescription\u003c/h3\u003e \n \u003cp\u003eYou‘ve been given N integers A[1], A[2],..., A[N]. On these integers,\u0026nbsp;you need to implement the following operations:\u003c/p\u003e \n \u003cul\u003e \n \u003cli\u003eC l r d: Adding a constant d for every {Ai | l \u0026lt;\u003d i \u0026lt;\u003d r}, and increase the timestamp by 1, this is the only operation that will cause the timestamp increase.\u0026nbsp;\u003c/li\u003e \n \u003cli\u003eQ l r: Querying the current sum of {Ai | l \u0026lt;\u003d i \u0026lt;\u003d r}.\u003c/li\u003e \n \u003cli\u003eH l r t: Querying a history sum of {Ai | l \u0026lt;\u003d i \u0026lt;\u003d r} in time t.\u003c/li\u003e \n \u003cli\u003eB t: Back to time t. And once you decide return to a past, you can never be access to a forward edition anymore.\u003c/li\u003e \n \u003c/ul\u003e \n \u003cp\u003e\u0026nbsp;.. N, M ≤ 10^5, |A[i]| ≤ 10^9, 1 ≤ l ≤ r ≤ N, |d| ≤ 10^4 .. the system start from time 0, and the first modification is in time 1, t ≥ 0, and won\u0027t introduce you to a future state.\u0026nbsp;\u003c/p\u003e \n一个长度为n的数组,4种操作 :\u003c/br\u003e\n\n (1)C l r d:区间[l,r]中的数都加1,同时当前的时间戳加1 。\u003c/br\u003e\n\n (2)Q l r:查询当前时间戳区间[l,r]中所有数的和 。\u003c/br\u003e\n\n (3)H l r t:查询时间戳t区间[l,r]的和 。\u003c/br\u003e\n\n (4)B t:将当前时间戳置为t 。回到过去t时刻,t之后的信息都会消失,即就不会再向前跳跃。\u003c/br\u003e\n\n 所有操作均合法 。\u003c/br\u003e\n \u003ch3\u003eInput\u003c/h3\u003e \n \u003cpre\u003en m\u003cbr\u003eA1 A2 ... An\u003cbr\u003e... (here following the m operations. )\u003c/pre\u003e \n \u003ch3\u003eOutput\u003c/h3\u003e \n \u003cpre\u003e... (for each query, simply print the result. )\u003c/pre\u003e \n \u003ch3\u003eExample\u003c/h3\u003e \n \u003cpre\u003e\u003cpre style\u003d\"text-align: left;\"\u003e\u003cstrong\u003eInput 1:\u003c/strong\u003e\u003cbr\u003e10 5\n1 2 3 4 5 6 7 8 9 10\nQ 4 4\nQ 1 10\nQ 2 4\nC 3 6 3\nQ 2 4\u003cbr\u003e\u003cbr\u003e\u003cstrong\u003eOutput 1:\u003c/strong\u003e\u003cbr\u003e4\n55\n9\n15\u003cbr\u003e\u003cstrong\u003e\u003cbr\u003eInput 2:\u003cbr\u003e\u003c/strong\u003e2 4\n0 0\nC 1 1 1\nC 2 2 -1\nQ 1 2\nH 1 2 1\u003cbr\u003e\u003cstrong\u003e\u003cbr\u003eOutput 2:\u003c/strong\u003e\u003cbr\u003e0\n1\u003c/pre\u003e\n\u003c/pre\u003e \n \u003c/div\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}}]}