{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003e“Hey! I have an awesome task with chameleons, \u003cspan class\u003d\"tex2jax_process\"\u003e$5$\u003c/span\u003e-th task for Saturday’s\n competition.”\u003c/p\u003e\n\n \u003cp\u003e“Go ahead…”\u003c/p\u003e\n\n \u003cp\u003e(…)\u003c/p\u003e\n\n \u003cp\u003e“That’s too difficult, I have an easier one, they won’t even\n solve that one.”\u003c/p\u003e\n\n \u003cp\u003e“You are given an array of \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e integers from the interval\n \u003cspan class\u003d\"tex2jax_process\"\u003e$[1, K]$\u003c/span\u003e. You need to\n process \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e queries. The\n first type of query requires you to change a number in the\n array to a different value, and the second type of query\n requires you to determine the length of the shortest contiguous\n subarray of the current array that contains all numbers from\n \u003cspan class\u003d\"tex2jax_process\"\u003e$1$\u003c/span\u003e to \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e.”\u003c/p\u003e\n\n \u003cp\u003e“Hm, I can do it in \u003cspan class\u003d\"tex2jax_process\"\u003e$\\mathrm{O}(N^6)$\u003c/span\u003e. What’s the limit\n for \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e?”\u003c/p\u003e\n\n \u003ch2\u003eInput\u003c/h2\u003e\n\n \u003cp\u003eThe first line of input contains the integers \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\leq N, M \\leq 100\\, 000$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq K \\leq 50$\u003c/span\u003e). The second line\n of input contains \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e\n integers separated by space, the integers from the array. After\n that, \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e queries follow,\n each in one of the following two forms:\u003c/p\u003e\n\n \u003cul class\u003d\"itemize\"\u003e\n \u003cli\u003e\n \u003cp\u003e“1 p v”—change the value of the \u003cspan class\u003d\"tex2jax_process\"\u003e$p$\u003c/span\u003e-th number into \u003cspan class\u003d\"tex2jax_process\"\u003e$v$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq p \\leq N, 1 \\leq v \\leq\n K$\u003c/span\u003e)\u003c/p\u003e\n \u003c/li\u003e\n\n \u003cli\u003e\n \u003cp\u003e“2”—what is the length of the shortest contiguous\n subarray of the array containing all the integers from\n \u003cspan class\u003d\"tex2jax_process\"\u003e$1$\u003c/span\u003e to \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e.\u003c/p\u003e\n \u003c/li\u003e\n \u003c/ul\u003e\n\n \u003ch2\u003eOutput\u003c/h2\u003e\n\n \u003cp\u003eThe output must consist of the answers to the queries of the\n second type, each in its own line. If the required subarray\n doesn’t exist, output \u003ctt class\u003d\"ttfamily\"\u003e-1\u003c/tt\u003e.\u003c/p\u003e\n\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\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\u003e4 3 5\n2 3 1 2\n2\n1 3 3\n2\n1 1 1\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n-1\n4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\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\u003e6 3 6\n1 2 3 2 1 1\n2\n1 2 1\n2\n1 4 1\n1 6 2\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n3\n4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}