{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eJB 是后缀自动机的国家奥林匹克辅导员。今天他提出了以下问题。\u003c/p\u003e\u003cp\u003e假设你有一个字符串 $$$S$$$,我们列出所有不同的子串在 $$$S$$$ 中。然后我们按照长度递增的顺序对字符串进行排序。对于长度相同的两个字符串,字典序较小的排在前面。现在我们有一个排序后的字符串序列 $$$A$$$。\u003c/p\u003e\u003cp\u003eJB 有 $$$Q$$$ 个问题,对于每个问题,他会给你一个整数 $$$k$$$,并让你告诉他在 $$$A$$$ 中第 $$$k$$$ 个字符串。\u003c/p\u003e\u003cp\u003e为了简化问题,你只需要告诉他第一次出现的字符串在 $$$S$$$ 中的左右位置。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个字符串 $$$S$$$ ($$$1\\leq |S|\\leq 10^6$$$),只包含小写字母。\u003c/p\u003e\u003cp\u003e第二行包含一个整数 $$$Q$$$ ($$$1\\leq Q\\leq 10^6$$$)。\u003c/p\u003e\u003cp\u003e接下来的 $$$Q$$$ 行描述了问题,每行包含一个整数 $$$k$$$ ($$$1\\leq k\\leq 10^{12}$$$)。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个问题,输出两个整数 $$$l, r$$$,表示答案字符串在 $$$S$$$ 中第一次出现的左右位置。如果 $$$k$$$ 大于 $$$A$$$ 的长度,只需输出 \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e-1 -1\u003c/span\u003e\"。\u003c/p\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\u003eccpcguilin\n5\n1\n10\n4\n8\n26\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 1\n2 3\n8 8\n1 2\n4 7\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\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\u003ebanana\n3\n5\n10\n16\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 2\n2 5\n-1 -1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}