Logo
(追記) (追記ここまで)

31301번 - Contest Advancement 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB117574845.283%

문제

You are the RCD for your regional contest. It just ended and you now need to decide which teams qualify for the next level of competition. The teams are uniquely ranked (there are no ties). The next level has a limit on how many teams from any given school can participate. However, if that limit causes there to be not enough teams advancing, the remaining slots will be filled by teams from schools over the limit. If this happens, you will always give preference to higher-ranking teams, even if it means many teams from the same school advancing.

Output, in rank order, the teams that qualify for the next contest.

입력

The first line of input contains three integers $n,ドル $k$ (1ドル \leq k < n \leq 10^5$) and $c$ ($ 1 \leq c \leq n$), where $n$ is the number of teams in the competition, $k$ is the number of teams that will advance, and $c$ is the limit on the number of teams that may advance from any given school.

Each of the next $n$ lines contains two integers $t$ and $s$ (1ドル \le t,s \le n$). Each line describes a team, with $t$ being the team's unique ID, and $s$ indicating the team's school. All team IDs will be distinct. The teams will be listed in rank order, with the highest ranking teams first.

출력

Output $k$ lines. On each line output a single integer, which is the ID of a team. List the IDs of the teams that qualified to advance in rank order.

제한

예제 입력 1

10 7 3
3 9
1 9
4 9
5 9
9 7
2 7
6 7
7 7
8 5
10 5

예제 출력 1

3
1
4
9
2
6
8

힌트

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2023 A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /