#P16847. [GKS 2021 #C] Rock Paper Scissors
[GKS 2021 #C] Rock Paper Scissors
Problem Description
You and your friend like to play Rock Paper Scissors. Each day you play exactly rounds and at the end of each day, you tally up the score from these rounds.
During each round, without any knowledge of the other person's choice, you each make your choice. Then, you both reveal the choice you made and determine your score. Rock wins over Scissors, Scissors wins over Paper, and Paper wins over Rock. Let , , and represent Rock, Paper, and Scissors. Every day you both agree on values and . If your choice wins, you get points. If you and your friend both pick the same choice, you get points. If your choice loses, you get nothing.
By accident, you see your friend's strategy written in an open notebook on a desk one day. Your friend keeps track of how many times you have chosen , , and so far during one day. Let be your choice of , , or on round , while is your friend's choice on the same round. Let be the number of times for . Similarly, let and be the total number of times you have chosen and , respectively, prior to round .
On round of each day, and , and your friend plays randomly due to the lack of information (i.e. your friend chooses each option with probability ). On every subsequent round, your friend decides by choosing with probability , with probability , and with probability . This strategy is adaptive and tough to beat!
You are going on vacation for the next days. You must leave your assistant with instructions on what choice to pick each round each day. Let integer be the average reward you are aiming for in this game after days. Given and (different values for different days), provide your instructions as a string of characters, ordered from round to round . Each character represents your choice for the corresponding round. Your goal is to choose your set of instructions so that the average expected value of the reward across all the days of your gameplay is at least . Note that you can choose different instructions for different values of and .
Input Format
The first line of the input gives the number of days, . The second line contains an integer , your targeted average reward after these days. Then the description of days follows. Each day is described as two integers and . is how much you get if your choice wins for each round that day. is how much you get for each round when your choice is the same as your friend's choice.
All the tests (except the sample test below) are generated as follows. We choose different values between and (with uniform distribution). Then for each of these values, there will be days, with equal to and equal to , , , and . Do not assume anything about the order of these days.
Output Format
For each day, output one line containing Case #: , where is the day number (starting from ) and is your choice of , , or on the -th round of the game. There should be no spaces between the choices.
The list of choices should result in an expected value that is greater than or equal to on average after days. There may be multiple solutions for a test case. If so, you may output any one of them. It is guaranteed that for given a solution exists.
2
30
60 0
60 60
Case #1: RSRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
Case #2: PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
Hint
In this sample test our targeted (average) reward across all days is .
For the first day, since , you can reach the total target by winning at least once. One possible strategy is to just get to that single win.
- On round , you choose . You have an equal chance of a win, a tie, or a loss, giving you an expected value of .
- On round , and . Your friend's probability of choosing is , which guarantees your friend's choice .
- If you choose , you are guaranteed a win, giving you a score of for round .
- Regardless of what you choose for all following rounds in the game, your expected value after just two rounds is , which is enough to reach our target.
Moreover, as we already will have the average across all days at least , for the second day we can use any strategy.
Note that this is not a unique solution. As long as the average expected score is , other outputs would also be accepted.
Limits
(for all tests except the sample where ).
.
and is one of , , , or .
Each day you play exactly rounds.
Test Set
.
Test Set
.
Test Set
.