P11067 [MX-X4-T7] "Jason-1" Ball

Background

Original link: .

Description

**This is an output-only problem.** You have $10$ boxes. Each task will give an $n$. Initially, the first $n$ boxes **may** contain some balls, and the last $10-n$ boxes are empty. Use lowercase letters to represent balls of each color. Initially there are at most three colors of balls, denoted by $\tt a, b, c$. In your program, you may use **any lowercase letter** to represent the corresponding color of balls. A box is defined to **contain** a string if, for every color of ball, the number of balls of that color in the box is not less than the number of occurrences of that letter in the string. To **delete** a string from a box means: for each lowercase letter in the string (each letter represents a ball), take one ball of the same color out of the box. Deletion is allowed only if the box contains the string. To **insert** a string into a box means: for each lowercase letter in the string (each letter represents a ball), put one ball of the same color into the box. You need to write a program to complete some tasks. The program may use the following statements: - `change x s y t`, where $x, y$ are non-negative integers not exceeding $10$, and $s, t$ are **non-empty** strings consisting only of lowercase letters or the single character `@` (**if it is `@`, then treat the string as the empty string**). If $x=0$, then let $k$ iterate from $1$ to $10$; otherwise, $k=x$. If box $k$ contains string $s$, delete $s$ from it, and insert string $t$ into box $y$; if $y=0$, then insert into the current $k$ (in place). This is considered a successful execution of the command. Every time a command is successfully executed, immediately return to the previous breakpoint, regardless of whether $k$ has been fully iterated. If the command is not successfully executed, jump to the next statement. - `#` denotes a breakpoint. **You must end the entire program with a line containing a breakpoint.** Assume line $0$ is also a breakpoint; this breakpoint is not counted in the cost. The **number of statements** can be taken simply as the total number of `change` and `#` in the program. The virtual breakpoint at line $0$ is not counted, and the final breakpoint line is counted. The **number of breakpoints** can be taken simply as the number of `#` in the program. The virtual breakpoint at line $0$ is not counted, and the final breakpoint line is counted. You may not use more than $100$ statements. You may not use boxes beyond $10$ or non-lowercase-letter balls. In any box, the number of balls of any color may not exceed $10^{8}$. The length of a single string in the program may not exceed $200$. For a single test case, the actual number of executed statements during simulation may not exceed $4 \times 10^5$. For a single test case, the sum of the sizes of character sets checked for containment may not exceed $10^7$ (see the provided checker). Let $n$ denote the maximum number of boxes used by the input. Let $mx$ denote the maximum number of balls of each color in each box initially. Let $max$ denote the maximum total number of balls across all boxes initially. Let $sum$ denote the total number of balls across all boxes initially. **Boxes not mentioned in the task must remain unchanged.** You need to complete the following $10$ tasks respectively. 1. $n=10, sum \le 100$. You need to put all $\tt a$-colored balls into box $1$, all $\tt b$-colored balls into box $2$, and all $\tt c$-colored balls into box $3$. 2. $n=10, sum \le 100$. You need to change all $\tt a$-colored balls into $\tt b$-colored balls, change all $\tt b$-colored balls into $\tt c$-colored balls, and change all $\tt c$-colored balls into $\tt a$-colored balls. These three operations should be completed simultaneously. 3. $n=10, sum \le 100$. You need to empty all boxes that do not contain any $\tt a$-colored balls. 4. $n=10, sum \le 100$. You need to insert one $\tt a$-colored ball into every non-empty box that does not contain any $\tt a$-colored balls. 5. $n=5, sum \le 5$. You need to place all balls, ordered by color from small to large (${\tt a} < {\tt b} < {\tt c}$), into boxes $1$ to $sum$ in order, with each box containing exactly one ball. The initial balls should not be kept. 6. $n=10, sum \le 100$. For each box, keep only one ball of a color with the maximum occurrence count. If multiple colors are tied for the maximum, make it the empty set. 7. $n=10, sum \le 100$. For each box, keep only the balls of the color with the maximum occurrence count. If multiple colors are tied for the maximum, keep the smallest color (${\tt a} < {\tt b} < {\tt c}$). 8. $n=1, mx \le 10$. Let the numbers of $\tt a, b, c$-colored balls be $A, B, C$. You need to, for each integer $x$ satisfying $1 \le x \le 5$, make box $x$ end up with exactly $A+Bx+Cx^2$ $\tt a$-colored balls, and no other colors. 9. $n=5, max \le 10$. The total number of balls in each of the $n$ boxes is equal. Sort the balls in each box from small to large to form a string, and it is guaranteed that all strings are pairwise different. You need to compute the lexicographic rank of each string, and then, in increasing lexicographic order, change the boxes to $\tt a, b, c, d, e$ respectively. 10. $n=5, max \le 10$. You need to compute the prefix sums of the $n$ boxes, i.e., copy all balls from all previous boxes once and put them into the current box. **Note: The subtasks are ordered by some rule, unrelated to difficulty.**

Input Format

This is an output-only problem. For each test point, the corresponding task is given in the [Description].

Output Format

For the given $10$ tasks, you need to name your programs `1.out` to `10.out` respectively, and submit these $10$ files compressed directly into a `zip` file. Each file should contain several lines. The first line contains a non-negative integer $L$, representing the number of statements you used. The next $L$ lines each contain one statement. **You must end with a breakpoint.**

Explanation/Hint

**[Custom checker data format]** The first line contains two integers $T, V$, representing the number of test cases and the scoring parameter. For each test case: The first line contains two integers $n, m$, representing the number of input boxes to describe and the number of output boxes to describe. The second line contains $n$ strings, describing the states of the first $n$ boxes in the input. The third line contains $m$ strings, describing the states of the first $m$ boxes in the output. **You still need to ensure that the other boxes are empty.** **Similarly, use `@` to represent the empty string.** **[How to use the custom checker]** After compiling `checker.cpp`, run in the command line: ``` checker [in] [out] [ans] ``` Here, `[in]` is the testdata, `[out]` is the program you want to test, and `[ans]` is the same content as `[in]`. For example, if you want to test the first sample and your program is named `1.out`, you need to copy `1.in` to the current directory first, and run: ``` checker 1.in 1.out 1.in ``` **[Scoring]** For each test point, several test cases will be evaluated internally. If your output has any of the following issues, then you get no score for that test point: - The output does not meet the requirements. - There are unrecognizable or invalid statements. - In some box, the number of balls of some color exceeds $10^8$. - More than $100$ statements are used. - The length of a single string in the program exceeds $200$. - Boxes not between $1$ and $10$ are used. - Non-lowercase-letter colors are used. - For a single test case, the actual number of executed statements exceeds $4 \times 10^5$. - For a single test case, the sum of the sizes of character sets checked for containment exceeds $10^7$ (see the provided checker). The number of statements can be taken simply as the total number of `change` and `#` in the program. The virtual breakpoint at line $0$ is not counted, and the final breakpoint line is counted. The number of breakpoints can be taken simply as the number of `#` in the program. The virtual breakpoint at line $0$ is not counted, and the final breakpoint line is counted. The cost of a program is the number of breakpoints times the number of statements, denoted as $val$. Otherwise, let the scoring parameter for the corresponding subtask be $V$, then your score is: $$\mathrm{score}=\begin{cases}11&V>val\\\Big\lfloor\frac{10}{\exp\left(1-\frac {V}{val}\right)}\Big\rfloor&\text{otherwise.}\end{cases}$$ The following table gives the scoring parameter $V$ for each task: | ID | $1$ | $2$ | $3$ | $4$ | $5$| $6$ | $7$ | $8$ | $9$ | $10$ | | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | | $V$ | $16$ | $16$ | $16$ | $16$ | $26$ | $8$ | $10$ | $18$ | $20$ | $30$ | Translated by ChatGPT 5