{"problem":{"name":"Shift and Inversions","description":{"content":"Given is a sequence $A = [a_0, a_1, a_2, \\dots, a_{N-1}]$ that is a permutation of $0, 1, 2, \\dots, N - 1$.   For each $k = 0, 1, 2, \\dots, N - 1$, find the inversion number of the sequence $B = [b_0,","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc190_f"},"statements":[{"statement_type":"Markdown","content":"Given is a sequence $A = [a_0, a_1, a_2, \\dots, a_{N-1}]$ that is a permutation of $0, 1, 2, \\dots, N - 1$.  \nFor each $k = 0, 1, 2, \\dots, N - 1$, find the inversion number of the sequence $B = [b_0, b_1, b_2, \\dots, b_{N-1}]$ defined as $b_i = a_{i+k \\bmod N}$.\nWhat is inversion number? The inversion number of a sequence $A = [a_0, a_1, a_2, \\dots, a_{N-1}]$ is the number of pairs of indices $(i, j)$ such that $i < j$ and $a_i > a_j$.\n\n## Constraints\n\n*   All values in input are integers.\n*   $2 ≤ N ≤ 3 \\times 10^5$\n*   $a_0, a_1, a_2, \\dots, a_{N-1}$ is a permutation of $0, 1, 2, \\dots, N - 1$.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$a_0$ $a_1$ $a_2$ $\\cdots$ $a_{N-1}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc190_f","tags":[],"sample_group":[["4\n0 1 2 3","0\n3\n4\n3\n\nWe have $A = [0, 1, 2, 3]$.\nFor $k = 0$, the inversion number of $B = [0, 1, 2, 3]$ is $0$.  \nFor $k = 1$, the inversion number of $B = [1, 2, 3, 0]$ is $3$.  \nFor $k = 2$, the inversion number of $B = [2, 3, 0, 1]$ is $4$.  \nFor $k = 3$, the inversion number of $B = [3, 0, 1, 2]$ is $3$."],["10\n0 3 1 5 4 2 9 6 8 7","9\n18\n21\n28\n27\n28\n33\n24\n21\n14"]],"created_at":"2026-03-03 11:01:13"}}