/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 900 点
問題文
この問題は output-only です。入力は与えられません。
長さ 4 の整数列 A=(A_1,A_2,A_3,A_4) があり、初期状態は (N,1,0,0) です。N の値はあなたには知らされません。 あなたの目標は、最終的に A のいずれかの要素を N^3 にすることです。
以下の 2 種類の操作を、合計 2026 回以下行えます。
- i j k(1\le i,j,k\le4):A_i を \max(0,A_j-A_k) に置き換える。^ i j(1\le i,j\le4):A_i を A_j^2 に置き換える。
添字はいずれも整数で、互いに等しくても構いません。どちらの操作でも、操作直前の数列 A を使って置き換え後の値を計算し、A_i のみを変更します。
操作の途中でいずれかの値が N^4 を超えると失敗です。
制約を満たすすべての N に対して目標を達成する、共通の操作列を出力してください。 ジャッジは各 N について A=(N,1,0,0) から操作列を実行し、途中で失敗せず、全操作終了後にいずれかの要素が N^3 となることを確認します。
制約
- 2\le N\le2000
- N は整数
入力
入力は与えられません。
出力
1 行目に操作回数 Q(0\le Q\le2026)を出力してください。
続く Q 行に、各操作を実行順に - i j k または ^ i j の形式で出力してください。
出力例
4 ^ 3 1 ^ 4 3 - 4 4 3 - 4 4 3
この例は出力形式を示すもので、正解ではありません。
N=2 の場合、初期状態は A=(2,1,0,0) です。各操作後の状態は次の通りです。
| 操作 | 操作後の A |
|---|---|
^ 3 1 |
(2,1,4,0) |
^ 4 3 |
(2,1,4,16) |
- 4 4 3 |
(2,1,4,12) |
- 4 4 3 |
(2,1,4,8) |
N=2 では目標を達成しますが、N=3 では最後に A=(3,1,9,63) となり、どの要素も N^3=27 になりません。
Score : 900 points
Problem Statement
This problem is output-only. No input is given.
There is an integer sequence of length 4, A=(A_1,A_2,A_3,A_4), whose initial state is (N,1,0,0). The value of N is not revealed to you. Your goal is to make some element of A equal to N^3 in the end.
You can perform the following two types of operations, at most 2026 times in total.
- i j k(1\le i,j,k\le4): Replace A_i with \max(0,A_j-A_k).^ i j(1\le i,j\le4): Replace A_i with A_j^2.
All indices are integers and may be equal to each other. The new value is computed from the values just before the operation, and only A_i is changed.
If any value exceeds N^4 during the operations, you fail.
Output a single sequence of operations that achieves the goal for every N satisfying the constraints. For each N, the judge executes the sequence of operations starting from A=(N,1,0,0), and checks that it does not fail along the way and that some element equals N^3 after all operations are finished.
Constraints
- 2\le N\le2000
- N is an integer.
Input
No input is given.
Output
On the first line, output the number of operations Q (0\le Q\le2026).
On the following Q lines, output the operations in the order they are performed, each in the format - i j k or ^ i j.
Sample Output
4 ^ 3 1 ^ 4 3 - 4 4 3 - 4 4 3
This example illustrates the output format and is not a correct answer.
When N=2, the initial state is A=(2,1,0,0). The state after each operation is as follows.
| Operation | A after the operation |
|---|---|
^ 3 1 |
(2,1,4,0) |
^ 4 3 |
(2,1,4,16) |
- 4 4 3 |
(2,1,4,12) |
- 4 4 3 |
(2,1,4,8) |
The goal is achieved for N=2, but for N=3, the final state is A=(3,1,9,63), and no element equals N^3=27.