{"problem":{"name":"Esoswap","description":{"content":"We have a permutation $P = P_0, P_1, \\ldots, P_{N - 1}$ of $0, 1, \\ldots, N - 1$. You can do the following operation on $P$ at most $2 \\times 10^5$ times: *   Announce an integer $i ~ (0 \\leq i \\leq ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc110_f"},"statements":[{"statement_type":"Markdown","content":"We have a permutation $P = P_0, P_1, \\ldots, P_{N - 1}$ of $0, 1, \\ldots, N - 1$.\nYou can do the following operation on $P$ at most $2 \\times 10^5$ times:\n\n*   Announce an integer $i ~ (0 \\leq i \\leq N - 1)$. Swap $P_i$ and $P_{(i + P_i) \\textrm{ mod } N}$.\n\nYour task is to sort $P$ in ascending order with this operation. If it is impossible, print `-1` instead.\n\n## Constraints\n\n*   All values in input are integers.\n*   $2 \\leq N \\leq 100$\n*   $P$ is a permutation of $0, 1, \\ldots, N - 1$.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$P_0$ $P_1$ $\\ldots$ $P_{N - 1}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc110_f","tags":[],"sample_group":[["8\n7 1 2 6 4 0 5 3","4\n6\n0\n3\n0\n\nThis sequence of operations sorts $P$ in ascending order, as follows:\n\n*   First, announce $i = 6$. We swap $P_6 (= 5)$ and $P_{(6 + 5) \\textrm{ mod } 8} = P_3 (= 6)$, turning $P$ into $7, 1, 2, 5, 4, 0, 6, 3$.\n    \n*   Then, announce $i = 0$. We swap $P_0 (= 7)$ and $P_{(0 + 7) \\textrm{ mod } 8} = P_7 (= 3)$, turning $P$ into $3, 1, 2, 5, 4, 0, 6, 7$.\n    \n*   Then, announce $i = 3$. We swap $P_3 (= 5)$ and $P_{(3 + 5) \\textrm{ mod } 8} = P_0 (= 3)$, turning $P$ into $5, 1, 2, 3, 4, 0, 6, 7$.\n    \n*   Finally, announce $i = 0$. We swap $P_0 (= 5)$ and $P_{(0 + 5) \\textrm{ mod } 8} = P_5 (= 0)$, turning $P$ into $0, 1, 2, 3, 4, 5, 6, 7$."]],"created_at":"2026-03-03 11:01:14"}}