cswork / OA打开练习工作台

UberOA #38

Find Top Two Teams

估计简单可在线判题

考点(AI 标注)原地数组

A team's points are 3×wins+draws; ties in points are broken by goal difference (goals scored minus goals conceded), in descending order. Output the indices of the top two distinct teams. If points and goal difference are exactly equal, the statement imposes no further ordering, and any valid tie order is accepted.

This site has made the standard input and output explicit.

输入格式

The first line contains n, followed by 4 lines giving, in order, the n win counts, draw counts, goals scored, and goals conceded. On this site 2≤n≤100000 and every value is in 0..10⁹.

输出格式

Output two distinct 0-based indices: first place, then second place.

样例 1

输入:

3
2 1 2
0 3 0
5 5 4
1 2 0

输出:

2 0

样例 2

输入:

2
0 0
0 0
0 0
0 0

输出:

1 0

样例 3

输入:

3
1 0 0
0 2 1
0 100 100
0 0 0

输出:

0 1

样例说明

Example 1: all three teams have 6 points; 0 and 2 tie for the lead with a goal difference of 4, so either 0 2 or 2 0 is accepted. Example 2: the two teams are identical, so both 0 1 and 1 0 are correct. Example 3: points 3, 2, 1 decide the ranking, and more goals cannot overcome points, so output 0 1.