{"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\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e每天Codehorses都会发布一个新的编程问题。因此,在接下来的$$$n$$$天里将发布$$$n$$$个问题:第$$$i$$$个问题的难度为$$$a_i$$$。\u003c/p\u003e\u003cp\u003ePolycarp想要选择三天,分别是$$$i$$$、$$$j$$$和$$$k$$$($$$i \u0026lt; j \u0026lt; k$$$),使得第$$$j$$$天和第$$$i$$$天的难度差等于第$$$k$$$天和第$$$j$$$天的难度差。换句话说,Polycarp希望等式$$$a_j-a_i\u003da_k-a_j$$$成立。\u003c/p\u003e\u003cp\u003e确定Polycarp以期望的方式选择三天的可能方式数量。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数$$$t$$$\u0026nbsp;— 输入中的测试用例数($$$1 \\le t \\le 10$$$)。然后是$$$t$$$个测试用例描述。\u003c/p\u003e\u003cp\u003e测试用例的第一行包含一个整数$$$n$$$\u0026nbsp;— 天数($$$3 \\le n \\le 2000$$$)。\u003c/p\u003e\u003cp\u003e测试用例的第二行包含$$$n$$$个整数$$$a_1, a_2, \\dots, a_n$$$,其中$$$a_i$$$是第$$$i$$$天的问题难度($$$1 \\le a_i \\le 10^9$$$)。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e输出$$$t$$$个整数\u0026nbsp;— 按照给定顺序,每个测试用例的答案。测试用例的答案是使得$$$1 \\le i \u0026lt; j \u0026lt; k \\le n$$$和$$$a_k-a_j\u003da_j-a_i$$$成立的索引三元组$$$i$$$、$$$j$$$和$$$k$$$的数量。\u003c/p\u003e"}},{"title":"示例 1","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\u003e4\n5\n1 2 1 2 1\n3\n30 20 10\n5\n1 2 2 3 4\n9\n3 1 4 1 5 9 2 6 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n1\n4\n5\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}