Story
NOTE THAT THIS STORY DOESN'T RELATE TO THE PROBLEM AT ALL!!!
"Hahahahaha", shouted Jonah,"What a perfect task!"During HKOI Mini Competition 1, The author of C2626 left the training room raged.
Please appreciate the following artwork carefully.
Here is the problem statement:
(BEWARE THIS IS NOT THE CONTEST PROBLEM!!!)
Alice is bragging about her bowling performance in front of Bob! Alice claims that she got $K$ points playing in the Hackerland Bowling League, which uses the following ruleset:
The game consists of $N$ frames. Each frame has $10$ bowling pins that Alice needs to knock down using up to two bowling balls. The score that Alice will get for the frame will vary according to the outcome, as listed below:
- Strike: all $10$ pins are knocked down by the first bowling ball of the frame. The player is rewarded $10 + (\text{the number of pins knocked down by the next 2 }$balls$)$ points, and the next frame will then begin. If there are less than 2 balls remaining, only the remaining balls will be counted. A strike is represented as X.
- Spare: all $10$ pins are knocked down by two bowling balls, and the first ball did not knock down all pins. The player is rewarded $10 + (\text{the number of pins knocked down by the first ball of the next frame})$ points. If the frame is the last frame, the player will only be rewarded $10$ points. A spare is represented as a / where $a$ is the number of pins knocked down with the first ball.
- Open frame: there are still pins remaining after both bowling balls are bowled. The player is rewarded $\text{the total number of pins knocked down by the 2 bowling balls of the frame}$. An open frame is represented as a b, where $a$ and $b$ are the number of pins knocked down with the 2 balls respectively.
For example, if Alice got X, 3 /, and 4 1 in 3 frames. She gets $10 + 3 + 7 = 20$ points in the first frame, $10 + 4 = 14$ points in the second frame, and $4 + 1 = 5$ in the third frame, which is a total of $20 + 14 + 5 = 39$ points.
Please help Bob determine if it is possible for Alice to get $K$ points in $N$ frames. If yes, find a way to do so.
Note that if there exist multiple ways of getting $K$ points in $N$ frames, you may output any of them.
Therefore, he spent
11451400 ms on this task.When lots of Wrong Answer appeared, he realized something wrong---Only 10 minutes till the end of the contest!
He left the room with fire in his eyes.
When he was on the train, his brain was filled with bowling balls and pins.
What if I arrange the balls in a specific way? Thought Jonah.
He go back home and wrote down the idea.
On the next day, he wrote C2626 on WYKOJ and asked Chris (s22r42) to test his task.
As Chris is not a professional programmer, he only solved the task in
69420.114514 hours, using a read-and-do technique.Then, he gave the task to meisgood (s22l19). meisgood solved the task within
114514.69420 minutes, using a well-known way of solving programming tasks.Finally, Adam reviewed the task and solved it within
69420.69420 ms.How long will you use to solve this task?
Problem
There are $R$ red balls, $Y$ yellow balls and $B$ blue balls on the table. Your target is to take all the balls from the table.
In $1$ move, you can take exactly $1$ ball from the table, with the following rules:
- If you take a red ball in this move, you cannot take a red ball in the next move.
- If you take a yellow ball in this move, you cannot take a yellow ball in the next move.
- If you take a blue ball in this move, you can only take a red ball in the next move.
You can take any type of ball in the first move. Once all the balls are taken, you win. If you cannot take all the balls, you lose.
Determine whether it is possible to win or not. If so, give a possible sequence of taking balls.
Input
The only line consists of $3$ integers $R$, $Y$ and $B$.
Output
If it's impossible for you to win, output -1.
Otherwise, output a valid sequence consisting of R, Y, B only. The sequence must not violate any rules mentioned above.
If there are multiple valid sequences, output any one of them.
Scoring
Denote $N=R+Y+B$.
For all test cases, $0 \le R, Y, B \le 10^6$, $1 \le N \le 10^6$.
Subtask $1$ $(7$ pts$)$: $N=1$
Subtask $2$ $(9$ pts$)$: $R=0$, $N \le 20$
Subtask $3$ $(13$ pts$)$: $B=0$
Subtask $4$ $(23$ pts$)$: $Y \ge R \ge B$
Subtask $5$ $(19$ pts$)$: $R \ge Y+B$
Subtask $6$ $(12$ pts$)$: $N \le 20$
Subtask $7$ $(17$ pts$)$: No Additional Constraints
Sample Test Cases
| Input | Output | |
|---|---|---|
| 0 1 0 | Y | |
| 2 1 1 | RYRB | |
| Another possible sequence is RYBR. | ||
| 1 2 3 | -1 | |
| It can be proven that there doesn’t exist a valid sequence to take all the balls. | ||
Scoring: Per Subtask
Authored by s22f26
Appeared in 2026 Mini Comp 2