Submit | All submissions | Best solutions | Back to list |
ELIM - Elimination |
Elimination of contestants from a live IQ contest on a TV channel is decided in phases.
Initially at phase 0, N
In the pth
You are required to write a program that identifies the
winner of the contest, given the following information:
Input may contain multiple test cases. For each case there are two input lines.
The first line gives N
In each input line integers are
separated by space. The input terminates with a line containing 0 as input.
For each test case there is only one output line. The line
prints the registration number of the winner of the contest.
Input
Output
Sample Input
23 18 6 20
4 2 2
29 57 4 33 5 12 16 18
7 1 5 3 2 1 1
0
Sample Output
18
29
Added by: | Jimmy |
Date: | 2008-12-09 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | ACM Kanpur 2006 |