#P15911. [TOPC 2024] Game of Rounding
[TOPC 2024] Game of Rounding
Description
Jack got a new video game called “Rounding,” which contains levels. The game features a global ranking system that ranks all players worldwide based on their scores. Jack wants to break the global record and let everyone know who the master of this game is, so he has investigated the scoring system extensively.
He finally understands the scoring rules: when a player finishes each level, they earn some points. The player’s score is the average points they earn per level, rounded to the nearest whole number. More precisely, if a player plays a total of levels and earns points respectively, their score will be . For example, if a player earns [2,3,3] points in 3 levels, their score will be .
Jack has practiced several times and knows the points he will earn in the -th level. He discovered an exploit in the game that allows him to skip some levels at the beginning and stop at any time. This means Jack can choose a pair of numbers where , and only play the levels from to .
Jack is curious about the maximum score he can achieve for each starting level for , and how many levels he should play to achieve that maximum score. If there are several answers that yield the maximum score, he should print the smallest number of levels, as playing the game for a long time is unhealthy.
Input Format
The first line contains an integer , indicating the number of test cases. Each test case consists of two lines. The first one contains an integer , indicating the number of levels in the video game. The second one contains space-separated integers, , representing the points Jack will earn in each level.
Output Format
For each test case, output integers in one line. The -th number indicates the number of levels Jack should play, starting from level , to achieve the maximum score. If there are several answers that achieve the maximum score, print the smallest number of levels.
3
3
1 3 3
4
1 2 3 4
5
2 3 2 3 3
2 1 1
4 2 2 1
2 1 2 1 1
Hint
- for .
- The sum of 's of all test cases is at most .
京公网安备 11011102002149号