{"problem":{"name":"Range Sums 2","description":{"content":"**This problem is interactive.** You are given a positive integer $N$. Snuke secretly holds a permutation $P=(P_1,P_2,\\dots,P_N)$ of $(1,2,\\dots,N)$ and a sequence $A=(A_1,A_2,\\dots,A_N)$ of positive ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc192_c"},"statements":[{"statement_type":"Markdown","content":"**This problem is interactive.**\nYou are given a positive integer $N$.\nSnuke secretly holds a permutation $P=(P_1,P_2,\\dots,P_N)$ of $(1,2,\\dots,N)$ and a sequence $A=(A_1,A_2,\\dots,A_N)$ of positive integers of length $N$. **It is guaranteed that $P_1<P_2$.**\nYou may send up to $2N$ queries to Snuke. A query is of the following form:\n\n*   Specify two **distinct** positive integers $s$ and $t$ with $1\\leq s,t\\leq N$, and you will be given the value of $\\displaystyle \\sum_{i=\\min(P_s,P_t)}^{\\max(P_s,P_t)}A_i$.\n\nDetermine $P$ and $A$.\n\n## Constraints\n\n*   $3\\leq N\\leq 5000$\n*   $1\\leq P_i\\leq N$ $(1\\leq i\\leq N)$\n*   $P_i\\ne P_j$ for $i\\ne j$.\n*   $P_1<P_2$\n*   $1\\leq A_i\\leq 10^9$ $(1\\leq i\\leq N)$\n*   $N$, $P_i$, and $A_i$ are integers.\n*   $P$ and $A$ are fixed before the interaction with the judge.\n\n## Input/output\n\nThis problem is interactive.\nFirst, $N$ is given from Standard Input:\n\n$N$\n\nNext, you may send at most $2N$ queries to Snuke. When sending a query by specifying two **distinct** positive integers $s,t$, output in the following format. Do not forget to include a newline at the end.\n\n? $s$ $t$\n\nAfter sending a query, you will receive a response from Snuke in the following format:\n\n$X$\n\nHere, $X$ is an integer:\n\n*   If $X\\ne -1$, then $X$ is the value of $\\displaystyle \\sum_{i=\\min(P_s,P_t)}^{\\max(P_s,P_t)}A_i$.\n*   If $X=-1$, then either $s,t$ do not satisfy the constraints or you have sent more than $2N$ queries.\n    *   In this case, your program is judged as incorrect and must terminate immediately.\n\nOnce you have determined $P$ and $A$, output your answer in the following format. This output does not count as a query.\n\n! $P_1$ $P_2$ $\\dots$ $P_N$ $A_1$ $A_2$ $\\dots$ $A_N$\n\n**Note that $P_1<P_2$.** After this output, terminate your program immediately.\nIf you output anything that does not follow the above formats, `-1` will be given as input.\n\n\\-1\n\nIn that case, your program is judged as incorrect and must terminate immediately.\n\n[samples]\n\n## Notes\n\n*   **After every output, be sure to end with a newline and flush the standard output. Failure to do so may result in a TLE.**\n*   When you output your answer, or receive `-1` from standard input, terminate your program immediately. Otherwise, the outcome is indeterminate.\n*   Note that extra newlines may be considered as an output format error.\n*   **The judge system for this problem is not adaptive.** That is, $P$ and $A$ are determined before the interaction with the judge and will not be changed at any point.","is_translate":false,"language":"English"}],"meta":{"iden":"arc192_c","tags":[],"sample_group":[],"created_at":"2026-03-03 11:01:14"}}