問題一覧 > 通常問題

No.2830 Don't Stop the Game

レベル : / AI推定難易度 : 1800 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 19
作問者 : twitteryou / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 11027 / 自分の提出
問題文最終更新日: 2024-08-02 17:19:42
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 439 (順位表) の他の問題:

Problem Statement

You were told that you play games too much, and your parent has set a password on your game. Moreover, your parent is cautious: letting $X$ be the game's password, they split it into $N$ integers whose sum is $X$, and entrusted each of them to a separate server.
You want to play the game, so you tried to somehow find the password. You managed to gain access to the servers, but you can only send strange queries.
The queries are as follows. Let $a_i$ be the number stored on the $i\ (1\leq i \leq N)\ $-th server. Also, $b_i\ (1 \leq i \leq N)\ $ initially have the value $0$.
Query $1$: Send an integer $j\ (1 \leq j \leq N)\ $. For each $b_i\ (1 \leq i \leq N)\ $, add the value $a_j^i$ and replace it with the result modulo $998244353$.
Query $2$: Send a permutation $\ P=(p_1,p_2,...,p_N)\ $ of $(1,2,...,N)\ $. For each $b_j\ (1 \leq j \leq N)\ $, add $\ \sum_{i=1}^{N} a_{p_i}j^{i-1}\ $ and replace it with the result modulo $998244353$.
Query $3$: Send integers $i,j\ (1 \leq i,j \leq N)\ $. Replace both $b_i$ and $b_j$ with $\ b_ib_j\ $ modulo $998244353$.
Query $4$: Send integers $i,x\ (1 \leq i \leq N,1 \leq x \leq 998244352)\ $. Replace $b_i$ with $\ b_ix\ $ modulo $998244353$.
Query $5$: Send integers $i,x\ (1 \leq i \leq N,1 \leq x \leq 998244352)\ $. Replace $b_i$ with $\ b_i+x\ $ modulo $998244353$.
You can send up to $1000$ queries in total. After all queries are finished, you are told only the value of $\ \sum_{i=1}^{N}b_i\ $ modulo $998244353$.
By asking your parent, you learned that $N=30\ $. Using this, perform operations so that $\sum_{i=1}^{N}a_i=(\sum_{i=1}^{N}b_i) \mod 998244353\ $ holds, and get the password.

Input


    

No input is given.
$a_i(1 \leq i \leq N)$ satisfy the following conditions.
・$0 \leq a_i \leq 10^7$
・$a_i$ are fixed by the judge before it reads the queries

Output

$M
\\query_1
\\query_2
\\ \ldots
\\query_M$

Letting $M$ be the number of queries, output in the format above. Here, $1 \leq M \leq 1000$ must hold.
Also, output each $query_i(1 \leq i \leq M)$ in one of the following forms.

$1
\\j$
$2
\\p_1 \ p_2 \ ... \ p_N$
$3
\\i \ j$
$4
\\i\  x$
$5
\\i \ x$

Here, each query must satisfy the following conditions.
Query 1
・$1 \leq j \leq N$
Query 2
・$(p_1,p_2,\ldots,p_N)\ $ is a permutation of $\ (1,2,\ldots,N)\ $
Query 3
・$1 \leq i,j \leq N$
Query 4
・$1 \leq i \leq N$
・$1 \leq x \leq 998244352$
Query 5
・$1 \leq i \leq N$
・$1 \leq x \leq 998244352$
Your output is judged as correct if it satisfies all of the above conditions and $\sum_{i=1}^{N}a_i=(\sum_{i=1}^{N}b_i) \mod 998244353\ $. The result is undefined if the constraints are not satisfied.

Sample

Sample 1
Input

            
Output
5
1
3
2
1 3 2
3
1 2
4
1 5
5
1 1000

Here, for simplicity, let $N=3$, which differs from the actual value. Also, let $\ (a_1,a_2,a_3)=(6,3,1)\ $. Initially, $\ (b_1,b_2,b_3)=(0,0,0)\ $.
The $1$st query makes $\ (b_1,b_2,b_3)=(0+1^1,0+1^2,0+1^3)=(1,1,1)\ $.
The $2$nd query makes $\ (b_1,b_2,b_3)=(6+1 \times 1+3 \times 1^2+1,6+1 \times 2+3 \times 2^2+1,6+1 \times 3+3 \times 3^2+1)=(11,21,37)\ $.
The $3$rd query makes $\ (b_1,b_2,b_3)=(11 \times 21 , 11 \times 21 ,37) =(231,231,37)\ $.
The $4$th query makes $\ (b_1,b_2,b_3)=(231 \times 5,231,37)=(1155,231,37)\ $.
The $5$th query makes $\ (b_1,b_2,b_3)=(1155+1000,231,37)=(2155,231,37)\ $.
Clearly $\ \sum_{i=1}^{N}a_i \neq (\sum_{i=1}^{N}b_i) \mod 998244353\ $ here, so this is judged as incorrect.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。