{"problem":{"name":"Beware of Overflow","description":{"content":"This is an **interactive problem** (where your program interacts with the judge via input and output). You are given a positive integer $N$. The judge has a hidden positive integer $R$ and $N$ integer","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc179_c"},"statements":[{"statement_type":"Markdown","content":"This is an **interactive problem** (where your program interacts with the judge via input and output).\nYou are given a positive integer $N$.\nThe judge has a hidden positive integer $R$ and $N$ integers $A_1, A_2, \\dots, A_N$. It is guaranteed that $|A_i|\\le R$ and $\\left|\\displaystyle\\sum_{i=1}^{N}A_i\\right| \\le R$.\nThere is a blackboard on which you can write integers with absolute values not exceeding $R$. Initially, the blackboard is empty.\nThe judge has written the values $A_1, A_2, \\dots, A_N$ on the blackboard **in this order**. Your task is to make the blackboard contain only one value $\\displaystyle\\sum_{i=1}^{N}A_i$.\nYou cannot learn the values of $R$ and $A_i$ directly, but you can interact with the judge up to $25000$ times.\nFor a positive integer $i$, let $X_i$ be the $i$\\-th integer written on the blackboard. Specifically, $X_i = A_i$ for $i=1,2,\\dots,N$.\nIn one interaction, you can specify two distinct positive integers $i$ and $j$ and choose one of the following actions:\n\n*   Perform addition. The judge will erase $X_i$ and $X_j$ from the blackboard and write $X_i + X_j$ on the blackboard.\n    *   $|X_i + X_j| \\leq R$ must hold.\n*   Perform comparison. The judge will tell you whether $X_i < X_j$ is true or false.\n\nHere, at the beginning of each interaction, the $i$\\-th and $j$\\-th integers written on the blackboard must not have been erased.\nPerform the interactions appropriately so that after all interactions, the blackboard contains only one value $\\displaystyle\\sum_{i=1}^{N}A_i$.\nThe values of $R$ and $A_i$ are determined before the start of the conversation between your program and the judge.\n\n## Constraints\n\n*   $2 \\leq N \\leq 1000$\n*   $1 \\leq R \\leq 10^9$\n*   $|A_i| \\leq R$\n*   $\\left|\\displaystyle\\sum_{i=1}^{N}A_i\\right| \\le R$\n*   $N$, $R$, and $A_i$ are integers.\n\n## Input And Output\n\nThis is an **interactive problem** (where your program interacts with the judge via input and output).\nFirst, read $N$ from Standard Input.\n\n$N$\n\nNext, repeat the interactions until the blackboard contains only one value $\\displaystyle\\sum_{i=1}^{N}A_i$.\nWhen performing addition, make an output in the following format to Standard Output. Append a newline at the end. Here, $i$ and $j$ are distinct positive integers.\n\n\\+ $i$ $j$\n\nThe response from the judge will be given from Standard Input in the following format:\n\n$P$\n\nHere, $P$ is an integer:\n\n*   If $P \\geq N + 1$, it means that the value $X_i + X_j$ has been written on the blackboard, and it is the $P$\\-th integer written.\n*   If $P = -1$, it means that $i$ and $j$ do not satisfy the constraints, or the number of interactions has exceeded $25000$.\n\nWhen performing comparison, make an output in the following format to Standard Output. Append a newline at the end. Here, $i$ and $j$ are distinct positive integers.\n\n? $i$ $j$\n\nThe response from the judge will be given from Standard Input in the following format:\n\n$Q$\n\nHere, $Q$ is an integer:\n\n*   If $Q = 1$, it means that $X_i < X_j$ is true.\n*   If $Q = 0$, it means that $X_i < X_j$ is false.\n*   If $Q = -1$, it means that $i$ and $j$ do not satisfy the constraints, or the number of interactions has exceeded $25000$.\n\nFor both types of interactions, if the judge's response is $-1$, your program is already considered incorrect. In this case, terminate your program immediately.\nWhen the blackboard contains only one value $\\displaystyle\\sum_{i=1}^{N}A_i$, report this to the judge in the following format. This does not count towards the number of interactions. Then, terminate your program immediately.\n\n!\n\nIf you make an output in a format that does not match any of the above, `-1` will be given from Standard Input.\n\n\\-1\n\nIn this case, your program is already considered incorrect. Terminate your program immediately.\n\n[samples]\n\n## Notes\n\n*   **For each output, append a newline at the end and flush Standard Output. Otherwise, the verdict may be TLE.**\n*   Terminate your program immediately after outputting the result (or receiving `-1`). Otherwise, the verdict will be indeterminate.\n*   Extra newlines will be considered as malformed output.","is_translate":false,"language":"English"}],"meta":{"iden":"arc179_c","tags":[],"sample_group":[],"created_at":"2026-03-03 11:01:14"}}