

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
から までの番号がついた 人が総当たり戦をしています。
すなわち、全ての組 について、人 と人 は 回試合をするので、試合は合計で 試合行われます。
なお、試合は必ず一方が勝者、もう一方が敗者となり、引き分けとなることはありません。
既に 試合が終了しており、 試合目では人 が人 に勝ちました。
総当たり戦が終了したとき、単独優勝をする可能性のある人を列挙してください。
ただし単独優勝とは、その人の勝利数が、他のどの人の勝利数よりも多いことを言います。
制約
- ならば、
- 入力は全て整数である
入力
入力は以下の形式で標準入力から与えられる。
出力
単独優勝をする可能性のある人の番号の集合を として、 を昇順に空白区切りで出力せよ。
すなわち、以下の形式で出力せよ。
入力例 1Copy
4 2 2 1 2 3
出力例 1Copy
2 4
人 は単独優勝する可能性があり、人 は単独優勝する可能性がありません。
なお、4 2
などの出力は不正解となることに注意してください。
入力例 2Copy
3 3 1 2 2 3 3 1
出力例 2Copy
単独優勝する可能性のある人がいないこともあります。
入力例 3Copy
7 9 6 5 1 2 3 4 5 3 6 2 1 5 3 2 6 4 1 4
出力例 3Copy
1 3 6 7
Score : points
Problem Statement
players numbered through will participate in a round-robin tournament.
Specifically, for every pair , Player and Player play a match against each other once, for a total of matches.
In every match, one of the players will be a winner and the other will be a loser; there is no draw.
matches have already ended. In the -th match, Player won Player .
List all the players who may become the unique winner after the round-robin tournament is completed.
A player is said to be the unique winner if the number of the player's wins is strictly greater than that of any other player.
Constraints
- If , then .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Let be the set of indices of players that may become the unique winner. Print in the increasing order, with spaces in between.
In other words, print in the following format.
Sample Input 1Copy
4 2 2 1 2 3
Sample Output 1Copy
2 4
Players and may become the unique winner, while Players and cannot.
Note that output like 4 2
is considered to be incorrect.
Sample Input 2Copy
3 3 1 2 2 3 3 1
Sample Output 2Copy
It is possible that no player can become the unique winner.
Sample Input 3Copy
7 9 6 5 1 2 3 4 5 3 6 2 1 5 3 2 6 4 1 4
Sample Output 3Copy
1 3 6 7