QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 100

#3214. 一切皆在心中

Statistics

Zhang 教授有一个数字序列 $a_1, a_2, \dots, a_n$。然而,该序列并不完整,其中一些元素缺失了。幸运的是,Zhang 教授还记得该序列的一些属性:

  • 对于每个 $i \in \{1, 2, \dots, n\}$,满足 $0 \le a_i \le 100$。
  • 该序列是非递增的:$a_1 \ge a_2 \ge \dots \ge a_n$。
  • 序列中所有元素的和不为零。

Zhang 教授想知道在所有可能的序列中,$\frac{a_1+a_2}{\sum_{i=1}^n a_i}$ 的最大值是多少。

输入格式

输入包含多组测试数据。第一行包含一个整数 $T$,表示测试数据的组数。对于每组测试数据:

第一行包含两个整数 $n$ 和 $m$ ($2 \le n \le 100, 0 \le m \le n$):序列的长度和已知元素的个数。

接下来的 $m$ 行,每行包含两个整数 $x_i$ 和 $y_i$ ($1 \le x_i \le n, 0 \le y_i \le 100, x_i < x_{i+1}, y_i \ge y_{i+1}$),表示 $a_{x_i} = y_i$。

测试数据最多有 2000 组,输入总大小不超过 350 KiB。

输出格式

对于每组测试数据,输出答案为一个最简分数 $p/q$,其中 $p$ 和 $q$ 为整数,且 $q > 0$。

样例

输入 1

2
2 0
3 1
3 1

输出 1

1/1
200/201

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.