Problem Description
The greatest company in the world, lezeron, wants you to customize a strange machine.
lezeron has built an assembly line that produces a product worth 50 Coins. However, since the line has just been built, defective items may appear, and your machine needs to identify these defective products.
The assembly line took defects into account, so every product is produced with a binary string as its code. To check a product, it suffices to check:
- In the initial product code, the number of
0and1are equal. - For every prefix of the initial product code, the number of
0is not less than the number of1.
But due to the product’s shape, properties, etc., your machine is heavily restricted during inspection. Specifically, your machine consists of $n$ inspection chambers, and each chamber is one of the following two types:
- Read chamber: reads and deletes the first character of the product code (if it exists), and depending on the character read (or if there is no character), sends the product to another chamber.
- Append chamber: appends an arbitrary character to the end of the product code, and sends the product to some chamber.
Your chambers are numbered $1 \sim n$. A newly produced product appears at chamber $1$. There are also two special chambers numbered $0$ and $-1$, which do not belong to the two types above. Specifically, a product sent to $0$ is marked as “qualified”, and a product sent to $-1$ is marked as “defective”.
Due to limited budget, you cannot have more than $302$ chambers, i.e. $1 \le n \le 300$. Besides characters 0 and 1, your append chambers may also write other characters. Specifically, you may define an alphabet size $m$, and your append chambers may write any character in $0 \sim m-1$. Since available characters are limited, you must ensure $2 \le m \le 128$.
Since your machine must be functional, it cannot send the same product more than $10^6$ times. If a product stays in the machine for too long, lezeron’s maintenance staff will shut down the machine, take out the product, and mark your inspection result as “wrong”.
Of course, since lezeron has an excellent reputation, a small amount of incorrect detections will not have a big impact. Therefore, lezeron allows your machine to have a certain error rate. Naturally, a perfect machine is always better: the better your machine is, the higher your salary (score) will be.
lezeron has planned 10 scenarios, each completely independent. The evaluation of your machine is the sum of its performance over all scenarios. Design a better machine to obtain a higher salary (score)!
Input Format
One line containing the string Print your beautiful answer!, so you cannot distinguish different test cases by input.
Output Format
The first line contains two positive integers $n, m$.
Then output $n$ lines, each containing several integers, where:
- The first integer is $t_i$, indicating the chamber type. If $t_i = 0$, it is a read chamber; otherwise, it is an append chamber.
- If it is a read chamber, then output $m+1$ integers $c_0, c_1, \dots, c_{m-1}, e$, where $c_i$ denotes the destination chamber when character $i$ is read, and $e$ denotes the destination chamber when the current product code is empty.
- If it is an append chamber, then output two integers $v, w$, meaning append character $v$ to the end of the product code and send the product to chamber $w$.
Example
Example Input
Print your beautiful answer!
Example Output
2 2
1 0 2
0 0 -1 1
Scoring
This problem has a total of $10$ test points, each worth $10$ points, corresponding to $10$ scenarios. Each scenario uses $100$ products to test your machine. Let $S={67,75,84,88,92,93,95,98,99,100}$. For each test point, if your machine correctly detects $k$ products, then for any $x \in S$, if $k \ge x$, you can obtain one point on this test point.
The sample output can correctly detect $61$ products in each scenario, so this sample can obtain 0 points.
For each test point, let the maximum length of all initial product codes be $L$. Then:
| Test Point ID | $L \le$ | Test Point ID | $L \le$ |
|---|---|---|---|
| $1$ | $2\times 10^2$ | $6$ | $3\times 10^4$ |
| $2$ | $1\times 10^3$ | $7$ | $5\times 10^4$ |
| $3$ | $1.2\times 10^3$ | $8$ | $3\times 10^5$ |
| $4$ | $5\times 10^3$ | $9$ | $9\times 10^5$ |
| $5$ | $1\times 10^4$ | $10$ | $9.5\times 10^5$ |
We provide a meaningless checker. You may compile it using any C++ standard (C++14 is recommended). After compilation (assume the executable name has suffix kzxwjm.exe), it will read your solution from standard input, read $L$ from command-line arguments, and test your solution using randomly generated codes.
Command to run: ./kzxwjm.exe Number_L (Linux), kzxwjm.exe Number_L (Windows), where Number_L is the $L$ in the data range. You may pass more arguments afterward, although it is meaningless.
You may modify this checker arbitrarily to meet your needs.