{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section 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\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"MD","content":"\u003csection\u003e\n \u003cp\u003eYou\u0027re given a \u003cb\u003epermutation\u003c/b\u003e $P_1, P_2, \\dots, P_N$ of the integers $1, 2, \\dots, N$.\u003c/p\u003e\n \u003cp\u003eIn one move, you can choose $K$ consecutive elements in the sequence and replace the value of each chosen element with the minimum value among the chosen elements.\u003c/p\u003e\n \u003cp\u003eFind the minimum number of operations required to make all the elements in the sequence equal.\u003c/p\u003e\n\u003c/section\u003e"}},{"title":"Constraints","value":{"format":"MD","content":"\u003csection\u003e\n \u003cul\u003e\n \u003cli\u003e\u003cvar\u003e\\(2 \\leq K \\leq N \\leq 10^5\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(P_1, P_2, \\dots, P_N\\)\u003c/var\u003e is a permutation of \u003cvar\u003e\\(1, 2, \\dots, N\\)\u003c/var\u003e.\u003c/li\u003e\n \u003c/ul\u003e\n\u003c/section\u003e"}},{"title":"Input","value":{"format":"MD","content":"\u003csection\u003e\n \u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\n \u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(K\\)\u003c/var\u003e\n\u003cvar\u003e\\(P_1\\)\u003c/var\u003e \u003cvar\u003e\\(P_2\\)\u003c/var\u003e \u003cvar\u003e\\(\\dots\\)\u003c/var\u003e \u003cvar\u003e\\(P_N\\)\u003c/var\u003e\n\u003c/pre\u003e\n\u003c/section\u003e"}},{"title":"Output","value":{"format":"MD","content":"\u003csection\u003e\n \u003cp\u003ePrint the minimum number of operations required.\u003c/p\u003e\n\u003c/section\u003e"}},{"title":"Sample 1","value":{"format":"MD","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\u003e4 3\n2 3 1 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n \u003cp\u003eOne optimal strategy is as follows:\u003c/p\u003e\n \u003cul\u003e\n \u003cli\u003e\u003cp\u003eIn the first operation, choose the first, second and third elements. The sequence \u003cvar\u003e\\(P\\)\u003c/var\u003e becomes \u003cvar\u003e\\(1, 1, 1, 4\\)\u003c/var\u003e.\u003c/p\u003e\u003c/li\u003e\n \u003cli\u003e\u003cp\u003eIn the second operation, choose the second, third and fourth elements. The sequence \u003cvar\u003e\\(P\\)\u003c/var\u003e becomes \u003cvar\u003e\\(1, 1, 1, 1\\)\u003c/var\u003e.\u003c/p\u003e\u003c/li\u003e\n \u003c/ul\u003e\n\u003c/section\u003e"}},{"title":"Sample 2","value":{"format":"MD","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\u003e3 3\n1 2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n\u003c/section\u003e"}},{"title":"Sample 3","value":{"format":"MD","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\u003e8 3\n7 3 1 8 4 6 2 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n\u003c/section\u003e"}}]}