{"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在这个问题中,给定一个字符串 s 和 q 个查询。\u003cbr\u003e\u003cbr\u003e对于每个查询,你需要回答当字符串 s 的所有不同子串按字典序排序后,第 k 小的是哪一个。\u003cbr\u003e\u003cbr\u003e字符串 s 的子串 s\u003csub\u003ei...j\u003c/sub\u003e (1 ≤ i ≤ j ≤ n) 是指字符串 s \u003d a\u003csub\u003e1\u003c/sub\u003ea\u003csub\u003e2\u003c/sub\u003e ...a\u003csub\u003en\u003c/sub\u003e 的子串 a\u003csub\u003ei\u003c/sub\u003ea\u003csub\u003ei+1\u003c/sub\u003e ...a\u003csub\u003ej\u003c/sub\u003e。如果 s\u003csub\u003ex...y\u003c/sub\u003e 和 s\u003csub\u003ez...w\u003c/sub\u003e 是不同的子串,则 s\u003csub\u003ex...y\u003c/sub\u003e ≠ S\u003csub\u003ez...w\u003c/sub\u003e。\u003cbr\u003e\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"输入包含多个测试用例,请一直处理直到文件结束。\u003cbr\u003e\u003cbr\u003e每个测试用例以包含仅包含小写字母的字符串 s(|s| ≤ 10\u003csup\u003e5\u003c/sup\u003e) 开始。\u003cbr\u003e\u003cbr\u003e接下来一行包含一个正整数 q(1 ≤ q ≤ 10\u003csup\u003e5\u003c/sup\u003e),表示查询的数量。\u003cbr\u003e\u003cbr\u003e接下来的 q 行给出了 q 个查询。每行包含一个整数 v。你应该通过计算 k \u003d (l♁r♁v)+1 (这里 l, r 是前一个问题的输出,在每个测试用例的开头,l \u003d r \u003d 0,0 \u003c k \u003c 2\u003csup\u003e63\u003c/sup\u003e,“♁”表示异或)。\u003cbr\u003e"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,输出包含 q 行,第 i 行包含两个整数 l, r,它们是第 i 个查询的答案。(答案 l, r 满足 s\u003csub\u003el...r\u003c/sub\u003e 是第 k 小的子串,如果有多个满足条件的 l, r,输出最小的 l, r。如果没有满足条件的 l, r,则输出“0 0”。注意 s\u003csub\u003e1...n\u003c/sub\u003e 是整个字符串)\u003cbr\u003e"}},{"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\u003eaaa\r\n4\r\n0\r\n2\r\n3\r\n5\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 1\r\n1 3\r\n1 2\r\n0 0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}