#P11067. 【MX-X4-T7】「Jason-1」Ball

【MX-X4-T7】「Jason-1」Ball

Background

Original link: https://oier.team/problems/X4H.

Problem Description

This is an output-only problem.

You have 1010 boxes. Each task will give an nn. Initially, the first nn boxes may contain some balls, and the last 10n10-n boxes are empty.

Use lowercase letters to represent balls of each color. Initially there are at most three colors of balls, denoted by a,b,c\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,yx, y are non-negative integers not exceeding 1010, and s,ts, 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=0x=0, then let kk iterate from 11 to 1010; otherwise, k=xk=x. If box kk contains string ss, delete ss from it, and insert string tt into box yy; if y=0y=0, then insert into the current kk (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 kk 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 00 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 00 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 00 is not counted, and the final breakpoint line is counted.

You may not use more than 100100 statements. You may not use boxes beyond 1010 or non-lowercase-letter balls. In any box, the number of balls of any color may not exceed 10810^{8}. The length of a single string in the program may not exceed 200200. For a single test case, the actual number of executed statements during simulation may not exceed 4×1054 \times 10^5. For a single test case, the sum of the sizes of character sets checked for containment may not exceed 10710^7 (see the provided checker).

Let nn denote the maximum number of boxes used by the input. Let mxmx denote the maximum number of balls of each color in each box initially. Let maxmax denote the maximum total number of balls across all boxes initially. Let sumsum 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 1010 tasks respectively.

  1. n=10,sum100n=10, sum \le 100. You need to put all a\tt a-colored balls into box 11, all b\tt b-colored balls into box 22, and all c\tt c-colored balls into box 33.

  2. n=10,sum100n=10, sum \le 100. You need to change all a\tt a-colored balls into b\tt b-colored balls, change all b\tt b-colored balls into c\tt c-colored balls, and change all c\tt c-colored balls into a\tt a-colored balls. These three operations should be completed simultaneously.

  3. n=10,sum100n=10, sum \le 100. You need to empty all boxes that do not contain any a\tt a-colored balls.

  4. n=10,sum100n=10, sum \le 100. You need to insert one a\tt a-colored ball into every non-empty box that does not contain any a\tt a-colored balls.

  5. n=5,sum5n=5, sum \le 5. You need to place all balls, ordered by color from small to large (a<b<c{\tt a} < {\tt b} < {\tt c}), into boxes 11 to sumsum in order, with each box containing exactly one ball. The initial balls should not be kept.

  6. n=10,sum100n=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,sum100n=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 (a<b<c{\tt a} < {\tt b} < {\tt c}).

  8. n=1,mx10n=1, mx \le 10. Let the numbers of a,b,c\tt a, b, c-colored balls be A,B,CA, B, C. You need to, for each integer xx satisfying 1x51 \le x \le 5, make box xx end up with exactly A+Bx+Cx2A+Bx+Cx^2 a\tt a-colored balls, and no other colors.

  9. n=5,max10n=5, max \le 10. The total number of balls in each of the nn 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 a,b,c,d,e\tt a, b, c, d, e respectively.

  10. n=5,max10n=5, max \le 10. You need to compute the prefix sums of the nn 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 1010 tasks, you need to name your programs 1.out to 10.out respectively, and submit these 1010 files compressed directly into a zip file.

Each file should contain several lines.

The first line contains a non-negative integer LL, representing the number of statements you used.

The next LL lines each contain one statement.

You must end with a breakpoint.

见附件 down.zip 中的 sample 文件夹
见附件 down.zip 中的 sample 文件夹

Hint

[Custom checker data format]

The first line contains two integers T,VT, V, representing the number of test cases and the scoring parameter.

For each test case:

The first line contains two integers n,mn, m, representing the number of input boxes to describe and the number of output boxes to describe.

The second line contains nn strings, describing the states of the first nn boxes in the input.

The third line contains mm strings, describing the states of the first mm 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 10810^8.
  • More than 100100 statements are used.
  • The length of a single string in the program exceeds 200200.
  • Boxes not between 11 and 1010 are used.
  • Non-lowercase-letter colors are used.
  • For a single test case, the actual number of executed statements exceeds 4×1054 \times 10^5.
  • For a single test case, the sum of the sizes of character sets checked for containment exceeds 10710^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 00 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 00 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 valval.

Otherwise, let the scoring parameter for the corresponding subtask be VV, 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 VV for each task:

ID 11 22 33 44 55 66 77 88 99 1010
VV 1616 2626 88 1010 1818 2020 3030

Translated by ChatGPT 5