{"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生活就像一场游戏,如果你输了,就选择自杀。\u003cbr\u003e但在你解决这个问题之前,你不能自杀:\u003cbr\u003e给定一个数字序列 a\u003csub\u003e1\u003c/sub\u003e, a\u003csub\u003e2\u003c/sub\u003e, ..., a\u003csub\u003en\u003c/sub\u003e。它们也是 1...n 的一个排列。\u003cbr\u003e你需要回答一些查询,每个查询的格式如下:\u003cbr\u003e如果我们从区间 [l, r] 中选择两个数字 a, b(不能相同),那么它们的最大公约数是多少?如果无法选择两个不同的数字(即 l\u003dr),那么答案就是零。\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"第一行包含一个数字 T(T \u0026lt;\u003d 5),表示测试用例的数量。\u003cbr\u003e 然后是 T 个测试用例。\u003cbr\u003e 对于每个测试用例,第一行包含一个数字 n(1 \u0026lt;\u003d n \u0026lt;\u003d 50000)。\u003cbr\u003e 第二行包含 n 个数字 a\u003csub\u003e1\u003c/sub\u003e, a\u003csub\u003e2\u003c/sub\u003e, ..., a\u003csub\u003en\u003c/sub\u003e。\u003cbr\u003e 第三行包含一个数字 Q(1 \u0026lt;\u003d Q \u0026lt;\u003d 50000),表示查询的数量。\u003cbr\u003e 接下来是 Q 行,每行包含两个整数 l, r(1 \u0026lt;\u003d l \u0026lt;\u003d r \u0026lt;\u003d n),表示一个查询。"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,对于每个查询在一行中输出答案。"}},{"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\u003e1\r\n10\r\n8 2 4 9 5 7 10 6 1 3\r\n5\r\n2 10\r\n2 4\r\n6 9\r\n1 4\r\n7 10\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\r\n2\r\n2\r\n4\r\n3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}