{"problem":{"name":"(K+1)-th Largest Number","description":{"content":"You are given a sequence $A = (A_1, A_2, \\ldots, A_N)$ of length $N$. For each $K = 0, 1, 2, \\ldots, N-1$, solve the following problem. > Find the number of integers $i$ between $1$ and $N$ (inclusiv","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc273_c"},"statements":[{"statement_type":"Markdown","content":"You are given a sequence $A = (A_1, A_2, \\ldots, A_N)$ of length $N$. For each $K = 0, 1, 2, \\ldots, N-1$, solve the following problem.\n\n> Find the number of integers $i$ between $1$ and $N$ (inclusive) such that:\n> \n> *   $A$ contains exactly $K$ distinct integers greater than $A_i$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq A_i \\leq 10^9$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\ldots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc273_c","tags":[],"sample_group":[["6\n2 7 1 8 2 8","2\n1\n2\n1\n0\n0\n\nFor example, we will find the answer for $K=2$.\n\n*   Regarding $A_1 = 2$, $A$ contains $2$ distinct integers greater than $A_1$: $7$ and $8$.\n*   Regarding $A_2 = 7$, $A$ contains $1$ distinct integer greater than $A_2$: $8$.\n*   Regarding $A_3 = 1$, $A$ contains $3$ distinct integers greater than $A_3$: $2, 7$, and $8$.\n*   Regarding $A_4 = 8$, $A$ contains $0$ distinct integers greater than $A_4$ (there is no such integer).\n*   Regarding $A_5 = 2$, $A$ contains $2$ distinct integers greater than $A_5$: $7$ and $8$.\n*   Regarding $A_6 = 8$, $A$ contains $0$ distinct integers greater than $A_6$ (there is no such integer).\n\nThus, there are two $i$'s, $i = 1$ and $i = 5$, such that $A$ contains exactly $K = 2$ distinct integers greater than $A_i$. Therefore, the answer for $K = 2$ is $2$."],["1\n1","1"],["10\n979861204 57882493 979861204 447672230 644706927 710511029 763027379 710511029 447672230 136397527","2\n1\n2\n1\n2\n1\n1\n0\n0\n0"]],"created_at":"2026-03-03 11:01:14"}}