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

21327번 - Quiz 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB61322959.184%

문제

In the quiz ProgrammeringsQuiz there are $N$ questions in total, distributed over $M$ different categories (for example, algorithm theory, compiler construction or Sven knowledge).

The questions are worth different amounts of points. Additionally, you will get a bonus $B$ if you answer all questions in a certain category. Simone has participated in Programmeringsolympiaden since 8th grade, so she is able to answer all the questions.

Unfortunately, there is a time limit to the quiz. Despite never giving the wrong answer, Simone will only have time to answer $K$ questions. What is the maximum number of points she can achieve?

입력

The first line consists of four integers 1ドル \le N \le 1000,ドル 1ドル \le M \le N,ドル 1ドル \le K \le N,ドル 1ドル \le B \le 100,000円$. The following $N$ lines consist of two integers each: the points given for answering the question (an integer between 1ドル$ and 1ドル,000円$) and which category it belongs to (between 1ドル$ and $M$). Each category will have at least one question.

출력

Print one line containing the maximal possible number of points.

제한

예제 입력 1

5 3 3 1000
300 1
400 1
200 2
200 3
300 3

예제 출력 1

2900

예제 입력 2

5 3 3 1
300 1
400 1
200 2
300 3
200 3

예제 출력 2

1001

힌트

In the first sample Simone answers both questions from category 1 (300ドル + 400 = 700$ points) and the only question in category 2 (200ドル$ points). Since these were the only questions in these two categories we get two bonuses, which gives a total of 200ドル + 700 + 2 \cdot 1000 = 2900$ points.

출처

Olympiad > Swedish Olympiad in Informatics > 2016 > Final D번

  • 문제를 만든 사람: Simon Lindholm
(追記) (追記ここまで)

출처

대학교 대회

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

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