[Solution] Gambling Codeforces Solution | Codeforces Problem Solution 2022
Marian is at a casino. The game at the casino works like this.
Before each round, the player selects a number between and . After that, a dice with faces is rolled so that a random number between and appears. If the player guesses the number correctly their total money is doubled, else their total money is halved.
Marian predicted the future and knows all the numbers that the dice will show in the next rounds.
He will pick three integers , and (). He will play rounds (rounds between and inclusive). In each of these rounds, he will guess the same number . At the start (before the round ) he has dollar.
Marian asks you to determine the integers , and (, ) such that he makes the most money at the end.
Note that during halving and multiplying there is no rounding and there are no precision errors. So, for example during a game, Marian could have money equal to , , , , , , etc. (any value of , where is an integer of any sign).
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the number of rounds.
The second line of each test case contains integers (), where is the number that will fall on the dice in the -th round.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output three integers , , and such that Marian makes the most amount of money gambling with his strategy. If there are multiple answers, you may output any of them.
No comments:
Post a Comment