No.2965 Don't Stop the Game again
タグ : / 解いたユーザー数 10
作問者 :
Story
Your mother has hidden your game again. Once again it has been left on a server, and the password has been split up...Because of what happened last time, countermeasures have been taken... but somehow it seems you can still send strange queries.
You are given the mission of recovering the password.
Problem Statement
There are integer sequences $A=(A_1,A_2,\cdots,A_{50})$ and $Q=(Q_1,Q_2,\cdots,Q_{50})$ of length $50$, and an integer $M$. It also holds that $\lbrace Q_1,Q_2,\cdots,Q_{50}\rbrace=\lbrace 1,2,\cdots,40\rbrace$.
Here, $Q$ and $M$ are given, but $A$ is not given and is kept hidden by the judge.
There is also an array $B$ of length $50$ whose elements are all initially $0$, and the following operations can be performed on $B$.
You can perform at most $250$ operations in total. Perform operations so that $\sum_{i=1}^{50}A_i \equiv \sum_{i=1}^{50}B_i$ holds modulo $\text{mod}$ $M$.
Input
$M$
$Q_1$ $Q_2$ $\cdots$ $Q_{50}$
Output
$K$
$\text{op}_1$
$\text{op}_2$
$\ldots$
$\text{op}_K$
Let $K$ be the number of operations, and output in the format above. Here, $1 \leq K \leq 250$ must hold.
Each $\text{op}_i(1 \leq i \leq K)$ must be output in one of the following forms.
$1$ $j$
$2$ $P_1$ $P_2$ $\cdots$ $P_{50}$
$3$ $i$ $j$ $k$
$4$ $i$ $j$ $k$
$5$ $i$ $j$ $k$
The following constraints must be satisfied. Otherwise, your answer is judged as incorrect.
Sample
| Program output | Judge output | Explanation |
|---|---|---|
7
1 2 3 | First, $Q$ and $M$ are given. At this point, the judge is hiding $A=(1,2,3)$. Also, $B=(0,0,0)$. | |
5 | First, output the number of operations. | |
1 3 | Operation $1$ is performed with $j=3$. Then $B$ changes to $(A_3^1$ $\text{mod}$ $7,A_3^2$ $\text{mod}$ $7,A_3^3$ $\text{mod}$ $7)=(3,2,6)$. | |
2 1 2 3 | Operation $2$ is performed with $P=(1,2,3)$. Then $B$ changes to $(3+A_1 \times 1^0+A_2 \times 1^1+A_3 \times 1^2$ $\text{mod}$ $7,2+A_1 \times 2^0+A_2 \times 2^1+A_3 \times 2^2$ $\text{mod}$ $7,6+A_1 \times 3^0+A_2 \times 3^1+A_3 \times 3^2$ $\text{mod}$ $7)=(2,5,5)$. | |
3 1 2 3 | Operation $3$ is performed with $i=1,j=2,k=3$. Then $B$ changes to $(2,5,B_1 \times B_2$ $\text{mod}$ $7)=(2,5,3)$. | |
4 2 1 3 | Operation $4$ is performed with $i=2,j=1,k=3$. Then $B$ changes to $(2,5,B_2+B_1$ $\text{mod}$ $7)=(2,5,0)$. | |
5 1 1 1 | Operation $5$ is performed with $i=1,j=1,k=1$. Then $B$ changes to $(B_1^{B_1}$ $\text{mod}$ $7,5,0)=(4,5,0)$. Clearly, $\sum_{i=1}^{3}A_i \neq \sum_{i=1}^{3}B_i$ modulo $\text{mod}$ $7$, so this is incorrect. |
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。