QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 2048 MB 満点: 100

#3859. 组织 SWERC

統計

Gianni 是 SWERC 的首席评委,他收到了大量高质量的题目,现在他必须为 SWERC 选择一套题目。

他收到了 $n$ 道题目,并为每道题目分配了美观度得分和难度。第 $i$ 道题目的美观度为 $b_i$,难度为 $d_i$。美观度和难度均为 $1$ 到 $10$ 之间的整数。

如果某种难度下没有题目(可能的难度为 $1, 2, \dots, 10$),那么 Gianni 将会向评委索要更多题目。

否则,对于 $1$ 到 $10$ 之间的每一个难度,他都会在题目集中放入该难度下最美观的一道题目(因此题目集将包含 $10$ 道难度各不相同的题目)。你需要计算题目集的总美观度,即 Gianni 所选题目美观度得分的总和。

输入格式

每个测试点包含多个测试用例。第一行包含一个整数 $t$ ($1 \le t \le 100$),表示测试用例的数量。接下来是 $t$ 个测试用例的描述。

每个测试用例的第一行包含一个整数 $n$ ($1 \le n \le 100$),表示 Gianni 从评委那里收到的题目数量。

接下来的 $n$ 行,每行包含两个整数。第 $i$ 行包含 $b_i$ 和 $d_i$ ($1 \le b_i, d_i \le 10$),分别表示第 $i$ 道题目的美观度得分和难度。

输出格式

对于每个测试用例,输出 Gianni 所选题目集的总美观度。如果 Gianni 无法创建题目集(因为缺少某个难度的题目),则输出字符串 MOREPROBLEMS(所有字母均为大写,中间没有空格)。

样例

输入 1

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

输出 1

MOREPROBLEMS
93

说明 1

在第一个测试用例中,Gianni 只收到了 $3$ 道题目,难度分别为 $3, 4, 7$,不足以组成一套题目(例如,因为没有难度为 $1$ 的题目)。

在第二个测试用例中,Gianni 将通过选取题目 $2, 3, 4, 5, 7, 8, 9, 10, 11$(它们的美观度均为 $10$,且涵盖了 $1$ 到 $9$ 的所有难度)以及题目 $1$ 和 $6$ 中的任意一道(它们的美观度均为 $3$,难度均为 $10$)来组成题目集。最终题目集的总美观度为 $10 \cdot 9 + 3 = 93$。

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.