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

11848번 - Schools 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB4391099030.612%

문제

Recently Akim of some state decided to open exactly M music and S sports schools to support education in the state. There are N different cities in the state. For each of the cities both the number of students ready to study in music school and the number of students ready to study in sports school is known. Being a big fan of efficiency, Akim doesn't want to open more than one school in any city (it's possible that he won't open any school in some cities).

You, as Akim's consultant, are given a task of developing a plan that would maximize the number of students that would study in the newly opened schools in the state.

입력

First line of input contains three integer numbers: N (1 ≤ N ≤ 300000), M, S (0 ≤ min(M, S), M + S ≤ N) - the number of cities in the state, the number of music and sports schools that Akim wishes to open respectively.

Each of the following N lines contains two integer numbers: Ai (1 ≤ Ai ≤ 105) and Bi (1 ≤ Bi ≤ 105) - the number of students in the i-th city that wish to study in music and sports school respectively.

출력

Output one integer number - the number of students that will study in the newly opened schools in an optimal plan.

제한

예제 입력 1

3 1 1
5 2
4 1
6 4

예제 출력 1

9

예제 입력 2

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

예제 출력 2

38

힌트

출처

Olympiad > International Zhautykov Olympiad > IZhO 2013 C번

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

출처

대학교 대회

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

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