Submit | All submissions | Best solutions | Back to list |
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
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 ) |
hide comments
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 |
|
2015-05-28 19:26:30 Kshitij Agarwal
can someone explain how the test case 1 get the output as mentioned.. |
|
2014-03-08 07:59:09 Gaurav Mishra
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 |
|
2014-03-08 07:59:09 Adam D
no extra spaces required at end ..... |
|
2014-03-08 07:59:09 shiva_hellgeek
@numerix: test case is correct... |
|
2014-03-08 07:59:09 nitish rao
thnx a million... @mayank. :) |
|
2014-03-08 07:59:09 shiv prasad chabarval
huh.. finally done thnx @mayank Last edit: 2013-06-19 06:29:50 |
|
2014-03-08 07:59:09 Kishan
getting WA again and again... :( plz someone provide me stronger test cases... Finally AC Thanks @Mayank Last edit: 2013-06-16 01:13:54 |
|
2014-03-08 07:59:09 Mayank gupta
Huh..Finally done..:) Guyz please take care of extra space after every output... Costed me WA..:P |