No.2828 Remainder Game
タグ : / 解いたユーザー数 75
作問者 :
Problem Statement
We will now play a number guessing game. There are $5$ integers $A_1$, $A_2$, $A_3$, $A_4$, $A_5$, each at least $1$ and at most $N$. These integers are kept secret.
Repeat the following query up to $30$ times to guess the sum of the $5$ integers, $\ A_1+A_2+A_3+A_4+A_5\ $.
・Choose an integer $M$ satisfying $1 \leq M \leq 10000\ $ and a set $R$ with $K$ elements, consisting of integers at least $0$ and less than $M$. Then, for $1 \leq i \leq 5\ $, the number of those $A_i$ whose remainder when divided by $M$ is in the set $R$ is returned.
However, when outputting the sum $S=A_1+A_2+A_3+A_4+A_5\ $, set $M=0,K=1$ and $R=\{S\}$. This also counts as $1$ query.
Also, $A_1,A_2,A_3,A_4,A_5$ are already fixed at the point when $N$ is given.
Input
$N$
First, $N$ is given.
・$1 \leq N \leq 1000$
・$N$ is an integer
The secret $A_i$ satisfy the following conditions.
・$1 \leq A_i \leq N\ (1 \leq i \leq 5)$
・$A_i$ is an integer $\ (1 \leq i \leq 5)$
Output
Letting $R$ be the set $\ \lbrace R_1, \ R_2 , \ldots ,\ R_K \rbrace\ $ with $K$ elements, output a query in the following format. If the output does not follow this format, the result is undefined. Flushing is recommended.
$M\ K$ $R_1 \ R_2 \ ... \ R_K$Then, letting $C$ be the judge's answer, the following input is given.
$C$Here, $C$ is an integer.
All of the following conditions must be satisfied. If these conditions are not satisfied, the result is also undefined.
・$1 \leq M \leq 10000$
・$1 \leq K \leq M$
・$0 \leq R_i \leq M-1\ (1 \leq i \leq K)$
・All $R_i$ are distinct
・$M,K,R_i(1 \leq i \leq K)$ are integers
As stated in the problem statement, when submitting your answer, output it as follows.
$0 \ 1$ $S$Here, the integer $S$ must satisfy $0 \leq S \leq 10000\ $.
Sample
Sample 1
Output
5 1 0 5 1 1 5 1 2 5 1 3 5 1 4 2000 5 1 2 3 4 5 0 1 15
Judge's Output
1000 1 1 1 1 1 5
Here, $\ A=[1,2,3,4,5]\ $. Therefore, in query number $1$, there is $1$ element whose remainder when divided by $5$ is $0$, so the system returns $1$.
Finally, the answer $15$ is given, and since this equals $\sum_{i=1}^{5}A_i$, it is correct.
Also, note that there may be cases where $A$ contains duplicate elements.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。