{"trustable":true,"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":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eYou have an array of N integers, named \u003cstrong\u003eVersion-0 \u003c/strong\u003earray. \u003cbr\u003eYou need to do \u003cstrong\u003eQ \u003c/strong\u003equeries. There are 2 type of queries.\u003c/p\u003e\r\n\u003col\u003e\r\n\u003cli\u003e\u003cstrong\u003eidx pos v\u003c/strong\u003e: Take \u003cstrong\u003eVersion-idx\u003c/strong\u003e array and copy it into another array. Name the new array \u003cstrong\u003eVersion-K\u003c/strong\u003e array where \u003cstrong\u003eK\u003c/strong\u003e \u003d (number of queries of 1st type before this query + 1). Then add \u003cstrong\u003ev \u003c/strong\u003ethe element at index \u003cstrong\u003epos\u003c/strong\u003e in \u003cstrong\u003eVersion-K \u003c/strong\u003earray. \u003c/li\u003e\r\n\u003cli\u003e\u003cstrong\u003eidx l r\u003c/strong\u003e: In \u003cstrong\u003eVersion-idx\u003c/strong\u003e array, sum the elements from index \u003cstrong\u003el \u003c/strong\u003eto \u003cstrong\u003er\u003c/strong\u003e. Print the sum of the range\u003c/li\u003e\r\n\u003c/ol\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eFirst line there will be an integer \u003cstrong\u003eN (1 \u0026lt;\u003d N \u0026lt;\u003d 100000)\u003c/strong\u003e, the length of the array. The following line wil contain \u003cstrong\u003eN \u003c/strong\u003eintegers, the elements of \u003cstrong\u003eVersion-0\u003c/strong\u003e array. Each element is non-negative and at most \u003cstrong\u003e100\u003c/strong\u003e.\u003c/p\u003e\r\n\u003cp\u003eThe next line will contain an integer \u003cstrong\u003eQ (1 \u0026lt;\u003d Q \u0026lt;\u003d 100000)\u003c/strong\u003e, the number of queries. Next \u003cstrong\u003eQ\u003c/strong\u003e lines will contain the queries. All queries in form\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003ea b c d\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003eIf \u003cstrong\u003ea \u003d 1\u003c/strong\u003e, then you have first kind of query and\u003cstrong\u003e idx \u003d b, pos \u003d c, v \u003d d.\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003eIf \u003cstrong\u003ea \u003d 2\u003c/strong\u003e, then you have second kind of query and \u003cstrong\u003eidx \u003d b, l \u003d c, r \u003d d.\u003c/strong\u003e\u003c/p\u003e\r\n\u003cp\u003eFor all queries, it is guaranteed that \u003cstrong\u003eVersion-idx\u003c/strong\u003e array exists. And\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003e1 \u0026lt;\u003d pos \u0026lt;\u003d N\u003cbr\u003e1 \u0026lt;\u003d l \u0026lt;\u003d r \u0026lt;\u003d N\u003cbr\u003e1 \u0026lt;\u003d v \u0026lt;\u003d 100\u003c/strong\u003e\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eIf you incounter an query of second type, you need to print the required sum in a seperate line. These should be printed in the order they appears in the input.\u003c/p\u003e\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10\n1 2 3 4 5 6 7 8 9 10 \n5\n2 0 1 6\n1 0 10 30\n1 1 2 10\n1 2 3 10\n2 3 2 3\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e21\n25\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}