{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e青蛙先生有一个长度为n的整数序列,可以表示为$a_1,a_2,\\cdots ,a_n$。有m个查询。\u003cbr\u003e\u003cbr\u003e在第i个查询中,给定两个整数$l_i$和$r_i$。考虑子序列$a_{l_i},a_{l_{i+1}},a_{l_{i+2}},\\cdots ,a_{r_i} $。\u003cbr\u003e\u003cbr\u003e我们可以将整数首次出现在该子序列中的位置(按照原始序列的位置)表示为$p_{1}^{(i)},p_{2}^{(i)},\\cdots, p_{k_i}^{(i)}$(按升序排列,即$p_{1}^{(i)}\u0026lt;p_{2}^{(i)}\u0026lt;\\cdots \u0026lt;p_{k_i}^{(i)}$)。\u003cbr\u003e\u003cbr\u003e注意$k_i$是该子序列中不同整数的数量。你应该输出第i个查询的$p_{\\left \\lceil \\frac{k_i}{2} \\right \\rceil}^{(i)}$。\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"在输入的第一行,有一个整数T($T\\leq 2$),表示测试用例的数量。\u003cbr\u003e\u003cbr\u003e每个测试用例以两个整数n($n \\leq \u0026#x14;2 \\times \u0026#x2;10^5$)和m($m\\leq 2\\times \u0026#x2;10^5$)开头。接下来一行有n个整数,表示序列中的整数(即$a_1,a_2,\\cdots ,a_n, 0\\leq a_i \\leq 2 \\times 10^5$)。\u003cbr\u003e\u003cbr\u003e接下来的m行中,每行有两个整数$l_i$和$r_i$。\u003cbr\u003e\u003cbr\u003e然而,青蛙先生认为这个问题太简单了,于是变得生气了。他将每个查询修改为$l_i^`,r_i^`(1\\leq l_i^` \\leq n,1\\leq r_i^` \\leq n )$。结果,问题变得更加有趣。\u003cbr\u003e\u003cbr\u003e我们可以将答案表示为$ans_1, ans_2,\\cdots ,ans_m$。注意对于每个测试用例$ans_0 \u003d 0$。\u003cbr\u003e\u003cbr\u003e你可以通过以下公式从你读到的内容中得到正确的输入$l_i,r_i$(我们将它们表示为$l_i^`,r_i^`$):\u003cbr\u003e$$ l_i \u003d min\\{ (l_i^`+ans_{i-1})\\ mod \\ n+1, (r_i^`+ans_{i-1})\\ mod \\ n+1 \\} $$\\\\$$ r_i \u003d max\\{ (l_i^`+ans_{i-1})\\ mod \\ n+1, (r_i^`+ans_{i-1})\\ mod \\ n+1 \\} $$"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,你应该输出一行。\u003cbr\u003e\u003cbr\u003e对于每个测试用例,输出一行“Case #x: $p_1,p_2,\\cdots ,p_m$”,其中x是案例编号(从1开始),$p_1,p_2,\\cdots ,p_m$是答案。"}},{"title":"示例","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\u003e2\r\n5 2\r\n3 3 1 5 4\r\n2 2\r\n4 4\r\n5 2\r\n2 5 2 1 2\r\n2 3\r\n2 4\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 3 3\r\nCase #2: 3 1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"提示","value":{"format":"HTML","content":"\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/bd7ab72dd09678ab6c1361f00cfd4d2c?v\u003d1713461821\"\u003e\u003cbr\u003e"}}]}