{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eAt the main street of Byteland, there will be built $$$n$$$ skyscrapers, standing sequentially one next to other. If look leftside right, sequence of their height will be $$$a_1,a_2,\\dots,a_n$$$.\u003c/p\u003e\u003cp\u003eInitially the street is empty, every skyscraper\u0027s height is $$$0$$$. Hamster is the leader of the construction team. In each stage, Hamster can select a range $$$[l,r]$$$, then the team will work on this range. Specifically, assume the height sequence is $$$h_1,h_2,\\dots,h_n$$$, then $$$h_l,h_{l+1},\\dots,h_r$$$ will increase by $$$1$$$ during this stage. When $$$h_i\u003da_i$$$ holds for all $$$i\\in[1,n]$$$, the project will be closed.\u003c/p\u003e\u003cp\u003eThe plan may be changed for many times. There will be $$$m$$$ events of $$$2$$$ kinds below:\u003c/p\u003e\u003cul\u003e \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e1 l r k\u003c/span\u003e\u0026nbsp;($$$1\\leq l\\leq r\\leq n,1\\leq k\\leq 10^5$$$), for all $$$x\\in [l,r]$$$, change $$$a_x$$$ to $$$a_x+k$$$. \u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e2 l r\u003c/span\u003e\u0026nbsp;($$$1\\leq l\\leq r\\leq n$$$), assume $$$a_1,a_2,\\dots,a_{l-1},a_{r+1},a_{r+2},\\dots,a_n\u003d0$$$, ask for the minimum number of required stages to close the project. \u003c/li\u003e\u003c/ul\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains an integer $$$T(1\\leq T\\leq 1000)$$$, denoting the number of test cases.\u003c/p\u003e\u003cp\u003eIn each test case, there are two integers $$$n,m(1\\leq n,m\\leq 100000)$$$ in the first line, denoting the number of skyscrapers and events.\u003c/p\u003e\u003cp\u003eIn the second line, there are $$$n$$$ integers $$$a_1,a_2,...,a_n(1\\leq a_i\\leq 100000)$$$.\u003c/p\u003e\u003cp\u003eFor the next $$$m$$$ lines, each line describes an event.\u003c/p\u003e\u003cp\u003eIt is guaranteed that $$$\\sum n\\leq 10^6$$$ and $$$\\sum m\\leq 10^6$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each query event, print a single line containing an integer, denoting the answer.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e1\n5 4\n1 3 1 4 5\n2 1 5\n1 3 4 2\n2 2 4\n2 1 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e7\n6\n6\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}