题目描述
Problem Description
Translated from COI 2021 T4 "MalnaRISC"
You need to use the magical processor MalnaRISC to solve the famous problem—sorting!
MalnaRISC supports only one command CMPSWP $R_i$ $R_j$, which means to compare the values in $R_i$ and $R_j$, and if $R_i > R_j$, swap them.
The most impressive feature of MalnaRISC is that it can run multiple different programs written on the same line simultaneously, as long as they do not conflict. That is, the parameters for CMPSWP must be used only once within the same line.
Now, please write a MalnaRISC program to sort a sequence of length $N$ in non-decreasing order. We will score your program based on its length.
Input Format
A single line containing an integer $N$.
Output Format
The first line is an integer $t$, representing the length of your code.
The next $t$ lines, each representing a line of your code.
Sample Input and Output
Sample Input #1
2
Sample Output #1
1
CMPSWP R1 R2
Sample Input #2
3
Sample Output #2
3
CMPSWP R1 R2
CMPSWP R1 R3
CMPSWP R2 R3
Sample Input #3
4
Sample Output #3
4
CMPSWP R1 R3
CMPSWP R2 R4
CMPSWP R1 R2 CMPSWP R3 R4
CMPSWP R2 R3
Notes/Hints
| Subtask | $N$ | $t_1$ | $t_2$ | $t_3$ | Score |
|---|---|---|---|---|---|
| $1$ | $8$ | $28$ | $12$ | $6$ | $10$ |
| $2$ | $13$ | $78$ | $22$ | $10$ | $10$ |
| $3$ | $16$ | $120$ | $28$ | $10$ | $10$ |
| $4$ | $32$ | $496$ | $60$ | $15$ | $10$ |
| $5$ | $53$ | $1378$ | $102$ | $21$ | $10$ |
| $6$ | $64$ | $2016$ | $124$ | $21$ | $10$ |
| $7$ | $73$ | $2628$ | $142$ | $28$ | $10$ |
| $8$ | $82$ | $3321$ | $160$ | $28$ | $10$ |
| $9$ | $91$ | $4095$ | $178$ | $29$ | $10$ |
| $10$ | $100$ | $4950$ | $196$ | $30$ | $10$ |
If your correct code is $t$ lines, then you will get the score rounded to the nearest integer:
$$
\text{score}(t)=
\begin{cases}
0 & t>t_1\\
1+\frac{2}{t-t_2} & t_1\ge t>t_2\\
3+\frac{7(t_2-t+1)}{t_2-t_3} & t_2\ge t>t_3\\
10 & t_3\ge t
\end{cases}
$$
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分