QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100 قابلة للهجوم ✓

#16895. 特別獎

الإحصائيات

有 $N$ 名學生參加了美術比賽。比賽由一名主辦方和一名評審共同決定獲獎者,獲獎者的決定方式如下:

  1. 主辦方和評審分別為所有學生的作品評分。兩人在評分時,皆不會給予兩件不同的作品相同的分數。
  2. 主辦方挑選 $M$ 名學生頒發特別獎。
  3. 評審從未獲得特別獎的學生作品中,挑選出自己評分最高的 $K$ 件作品,並將本獎頒發給對應的 $K$ 名學生。

主辦方希望在不論獎項種類的情況下,使所有獲獎學生作品的「主辦方評分」總和最大化。請計算出該總和的最大值。

輸入格式

第一行包含學生總數 $N$、特別獎名額 $M$ 以及本獎名額 $K$,以空格分隔。($2 \le N \le 2 \times 10^5$; $1 \le M, K \le N - 1$; $M + K \le N$)

接下來 $N$ 行,每行包含該作品的主辦方評分 $a_i$ 與評審評分 $b_i$,以空格分隔。($0 \le a_i, b_i \le 10^9$) 分數皆為整數,且對於 $i \neq j$ 滿足 $a_i \neq a_j$ 以及 $b_i \neq b_j$。

輸出格式

輸出所有獲得 $M + K$ 個獎項的學生作品中,主辦方評分總和的最大值。

範例

輸入 1

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

輸出 1

33

說明

若主辦方選擇第一位和第四位學生頒發特別獎,評審會根據自己給出的分數,將本獎頒發給第二位、第六位和第七位學生。此時,這 5 名獲獎學生的作品中,主辦方評分的總和為 33,且可以證明這是可能的最大值。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.