luogu#P9087. 「SvR-2」音符
「SvR-2」音符
Problem Description
In this problem, “substring” means:
If there is a segment of continuous characters in a string that forms a string , then is a substring of .
We use a string to represent a sheet music score, and use a character to represent each note.
We define an “accent” as the occurrence of two consecutive identical characters in the sheet music. For example, there are “accents” in .
Now Sept is going to write a sheet music of length for Tpes to see. His evaluation rules are as follows:
- Each time an “accent” appears in the sheet music, his anger value increases by .
- For each substring of length that contains no “accent”, his anger value increases by .
Given , please help Sept construct a sheet music such that Tpes’s anger value is minimized.
Input Format
This problem has multiple test cases.
The first line contains an integer , indicating the number of test cases.
The next lines each contain four integers , with meanings as described in the statement.
Output Format
Output a total of lines. For each test case, output two lines:
- Line 1: Tpes’s minimum anger value .
- Line 2: The sheet music you constructed.
2
4 5 2 2
8 6 3 2
0
Sept
3
2023yyds
Hint
Constraints and Notes
This problem uses bundled testdata.
| No special limit | ||||
| No special limit | ||||
For of the testdata, , , . Within a single test case, it is guaranteed that .
Output Notes
Outputting and constructing the sheet music can be considered as two separate subtasks. If you can only finish one of them, please use a valid character or number as a placeholder in the position corresponding to the other subtask.
You may output any characters in the sheet music, including digits, uppercase and lowercase letters, etc., but spaces are not allowed.
Special Judge Return Message Explanation
This problem uses a Special Judge to determine whether your answer is correct.
checker.cpp will return messages in the form .
The category indicates your scoring status. can take the following values:
- , meaning:
$\text{Accepted.} \texttt{ Your Ans and SM are both proper.}$
This means all answers meet the requirements. - , meaning:
$\text{Partially Correct.}\texttt{ All Ans are right.}$
This means in this test point, all your reported are correct, and you can get of the score for this test point. - , meaning:
$\text{Partially Correct.}\texttt{ You pass 70\% tests!}$
This means in this test point, the number of test cases you answered correctly is at least (both and the sheet music meet the requirements), and you can get of the score for this test point. - , meaning you can only get points for this test point.
The category indicates your error type. can take the following values:
- , meaning all your answers are correct, paired with .
- , meaning:
$\text{Wrong Answer.}\texttt{ The length of your SM is not right!}$
This means in one test case, the length of the sheet music you constructed is not . - , meaning:
$\text{Wrong Answer.}\texttt{ Your Ans is not right!}$
This means in one test case, the value of you output is wrong. - , meaning:
$\text{Wrong Answer.}\texttt{ Your Ans and SM are not matched!}$
This means in one test case, the anger value produced by your constructed sheet music is not .
Here, stand for Answer (the value of ) and Sheet Music (the sheet music).
Note that only reflects the type of the first error in this test point.
Translated by ChatGPT 5