atcoder#ABC260B. [ABC260B] Better Students Are Needed!
[ABC260B] Better Students Are Needed!
Score : points
Problem Statement
examinees took an entrance exam. The examinee numbered scored points in math and points in English.
The admissions are determined as follows.
- examinees with the highest math scores are admitted.
- Then, among the examinees who are not admitted yet, examinees with the highest English scores are admitted.
- Then, among the examinees who are not admitted yet, examinees with the highest total scores in math and English are admitted.
- Those examinees who are not admitted yet are rejected.
Here, in each of the steps 1. to 3., ties are broken by examinees' numbers: an examinee with the smaller examinee's number is prioritized. See also Sample Input and Output.
Print the examinees' numbers of the admitted examinees determined by the steps above in ascending order, separated by newlines.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the examinees' number of the admitted examinees in ascending order, separated by newlines.
6 1 0 2
80 60 80 60 70 70
40 20 50 90 90 80
1
4
5
- First, examinee with the highest math score is admitted.- Examinee is tied with Examinee , scoring the highest points in math, and the tie is broken by the examinees' numbers, so Examinee is admitted.
- Then, among the examinees who are not admitted yet, examinees with the highest English scores are admitted.- Obviously, it does not affect the admissions.
- Then, among the examinees who are not admitted yet, examinees with the highest total scores in math and English are admitted.- First, among the examinees who are not admitted yet, Examinee is admitted, scoring the highest total score of points.
- Next, among the examinees who are not admitted yet, Examinee is tied with Examinee , scoring a total score of points. The tie is broken by the examinees' numbers, and Examinee is admitted.
Therefore, the examinees' numbers of the admitted examinees are , , and . Print them in ascending order.
5 2 1 2
0 100 0 100 0
0 0 100 100 0
1
2
3
4
5
All examinees may be admitted.
15 4 3 2
30 65 20 95 100 45 70 85 20 35 95 50 40 15 85
0 25 45 35 65 70 80 90 40 55 20 20 45 75 100
2
4
5
6
7
8
11
14
15