#P1309. [NOIP 2011 普及组] 瑞士轮
[NOIP 2011 普及组] 瑞士轮
Description
players, numbered , play rounds. Before each round starts, and after all matches are finished, players are ranked in descending order by total points. A player's total points equal the initial points before round plus the sum of points earned in all matches already played. If the total points are the same, the player with the smaller id ranks ahead.
The pairings of each round depend on the ranking at the start of that round: rank vs rank , rank vs rank , ..., rank vs rank , ..., rank vs rank . The winner of each match gets point and the loser gets points. That is, except for the first round, the arrangements of the other rounds cannot be determined in advance; they depend on the players' performances in previous matches.
Given each player's initial points and strength value, compute the id of the player ranked -th after rounds. We assume all strength values are pairwise distinct, and in every match the player with the higher strength always wins.
Input Format
The first line contains three positive integers , separated by single spaces, indicating there are players, rounds, and we are interested in the -th place.
The second line contains non-negative integers , separated by single spaces, where denotes the initial points of the player with id .
The third line contains positive integers , separated by single spaces, where denotes the strength value of the player with id .
Output Format
Output a single integer: the id of the player ranked -th after rounds.
2 4 2
7 6 6 7
10 5 20 15
1
Hint
Sample Explanation:

Constraints:
- For of the testdata, .
- For of the testdata, .
- For of the testdata, , , , , .
NOIP 2011 Junior Problem 3.
Translated by ChatGPT 5
京公网安备 11011102002149号