#P9763. [ROIR 2021] 基因突变 (Day 1)
[ROIR 2021] 基因突变 (Day 1)
Background
Translated from ROIR 2021 Day 1 T3 Изменённая ДНК。
Problem Description
We define that a valid gene string contains only A, G, C, and T.
We define that any valid gene string has a compressed string. The compressed string replaces each maximal consecutive block of the same letter in the original gene string with: the number of occurrences followed by that letter. If the number is , the number is omitted.
Example: the compressed string of AAAAACAAAAACC is 5AC5A2C.
Now you are given a valid gene string , whose compressed string is . You may perform exactly one operation on . The operation can be one of the following three types:
- Insert a character after the -th character of .
- Delete the -th character of .
- Replace the -th character of with another character .
Let become after the operation, and let the compressed string of be . Find one operation plan that minimizes the length of , and one operation plan that maximizes the length of .
Input Format
One line containing a string .
Output Format
Output two lines in total. The first line is one plan that minimizes the length of . The second line is one plan that maximizes the length of .
The output format for a plan is as follows:
- If you want to use operation , output in the form
1 x Z. - If you want to use operation , output in the form
2 x. - If you want to use operation , output in the form
3 x Z.
5AC5A2C
3 6 A
1 2 C
Hint
[Sample Explanation]:
AAAAACAAAAACC.
After applying operation 3 6 A, we have AAAAAAAAAAACC, and 11A2C.
After applying operation 1 2 C, we have AACAAACAAAAACC, and 2AC3AC5A2C.
[Constraints]:
For all subtasks, , .
| Subtask ID | Constraints | Points |
|---|---|---|
| , | ||
| , | ||
| No special constraints |
Translated by ChatGPT 5