CLASSICO - Yell Classico
The Old Yellers, the contestants of the old days of IIUC are going to have a football match with the current contestants. As the yellers are going to be the host of the match, it will be called 'Yell Classico'. As the yellers are always busy in yelling, oops, I mean programming, they have appointed you as the manager of their team. Now, as a manager of the Yeller team, you have to select 11 players for the match from N players.
All the N players will stand in a line just before the match. Your task will be to select 11 players from them in such a way that, the player standing in front is as tall as possible. If there are more than one such team formations, do it in a way where the 2nd player is as tall as possible. If still there is a tie, choose the formation having tallest player in the 3rd position and so on. (Which means, until you can break the tie or reach the 11th position, keep looking in the next position).
Note that:
- You don't have enough time to change the order in which players are standing.
- If you have tie even after reaching the 11th position, select from any of the tied formations.
Players are quite same in their playing abilities, you don't need to bother about that.
Input
First line of input will contain the number of test cases, T < 100.
For each test case, there are two lines.
The first line contain N (number of players, 1 < N < 2000).
The second one is a line of N integers separated by spaces. The ith integer of this line will specify the height of the ith player. (Heights will not be greater than 109).
Output
For each test case output 'Case X: ', (X is the case number, starting from 1). Then print the heights of the 11 selected players separated by spaces. If it's not possible to select exactly 11 players, then send the spectators home by printing 'go home!' (Without quotations). See the sample output for exact formatting.
Example
Input: 4 15 2 10 8 5 1 5 9 9 3 5 6 6 2 2 8 11 2 6 3 8 7 2 5 3 4 3 3 4 2 7 9 6 12 6 2 3 8 7 2 5 3 4 3 3 10 Output: Case 1: 10 8 9 9 3 5 6 6 2 2 8 Case 2: 2 6 3 8 7 2 5 3 4 3 3 Case 3: go home! Case 4: 6 3 8 7 2 5 3 4 3 3 10
Problem Setter: Bidhan Roy
hide comments
smso:
2024-04-02 10:05:59
Statement is vague as hell. 2nd and 3rd cases are useless. Either the first case was clearly explained or more meaningful testcases were provided. This is the job of the problem setter and not for the rest to guess. Last edit: 2024-04-02 10:06:59 |
|
Kshitij Agarwal:
2015-05-28 19:26:30
can someone explain how the test case 1 get the output as mentioned.. |
|
Gaurav Mishra:
2014-03-08 07:59:09
i am getting segmentation fault with c and when i used python i got nzec, i dont understand y. Can anyone help me understand the reason c-9922753 and python - 9923031 Any help will be very nice.. Please let me know the reason. Code is small wont take much time Last edit: 2013-08-27 13:41:45 |
|
Adam D:
2014-03-08 07:59:09
no extra spaces required at end ..... |
|
shiva_hellgeek:
2014-03-08 07:59:09
@numerix: test case is correct... |
|
nitish rao:
2014-03-08 07:59:09
thnx a million... @mayank. :) |
|
shiv prasad chabarval:
2014-03-08 07:59:09
huh.. finally done
|
|
Kishan:
2014-03-08 07:59:09
getting WA again and again... :(
|
|
Mayank gupta:
2014-03-08 07:59:09
Huh..Finally done..:)
|
Added by: | Bidhan |
Date: | 2013-05-26 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Own Problem ( http://uva.onlinejudge.org/external/125/12580.html ) |