← 返回 capitalone 的题目列表Team Ranking Based on Scores and Goal Difference
类型:online_judge
In a competition, a scoring system awards 3 points for a win, 1 point for a draw, and 0 points for a loss. In case of a tie, rank based on goal difference (goals scored - goals conceded). Given arrays wins, draws, scored, and concedes, determine the indices of the first and second ranked teams. Complexity should be O(nlogn).
Input: wins = [3, 2, 1], draws = [0, 2, 3], scored = [10, 8, 7], concedes = [5, 7, 8] Output: [0, 1] Explanation: Team 0 has the highest score; Teams 1 and 2 have the same score, but Team 1 has a better goal difference.
Number of teams does not exceed 10^5.
Example
Input
wins = [3, 2, 1], draws = [0, 2, 3], scored = [10, 8, 7], concedes = [5, 7, 8]