{"trustable":true,"sections":[{"title":"Background","value":{"format":"MD","content":"模板题,无背景。 \n\n2019.12.12 更新数据,放宽时限,现在不再卡常了。"}},{"title":"Description","value":{"format":"MD","content":"给出项数为 $n$ 的整数数列 $a_{1 \\dots n}$。\n\n定义函数 $f(i)$ 代表数列中第 $i$ 个元素之后第一个大于 $a_i$ 的元素的**下标**,即 $f(i)\u003d\\min_{i\u003cj\\leq n, a_j \u003e a_i} \\{j\\}$。若不存在,则 $f(i)\u003d0$。\n\n试求出 $f(1\\dots n)$。"}},{"title":"Input","value":{"format":"MD","content":"第一行一个正整数 $n$。\n\n第二行 $n$ 个正整数 $a_{1\\dots n}$。"}},{"title":"Output","value":{"format":"MD","content":"一行 $n$ 个整数表示 $f(1), f(2), \\dots, f(n)$ 的值。 "}},{"title":"Sample 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\u003e5\n1 4 2 3 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 5 4 5 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"MD","content":"【数据规模与约定】\n\n对于 $30\\%$ 的数据,$n\\leq 100$;\n\n对于 $60\\%$ 的数据,$n\\leq 5 \\times 10^3$ ;\n\n对于 $100\\%$ 的数据,$1 \\le n\\leq 3\\times 10^6$,$1\\leq a_i\\leq 10^9$。"}}]}