QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 64 MB Points totaux : 100

#12097. 字节球匹配

Statistiques

Bytean 国家队正在参加 Byteball 世界杯。一场 Byteball 比赛持续 64 分钟;进球数较多的队伍获胜。如果两队进球数相同,则比赛以平局告终。在单场比赛中,每支队伍可以打进任意数量的球。

所有参赛队伍被分为两个小组。在每个小组中,各队进行单循环赛(即每支队伍都要与其他所有队伍交手一次)。胜者积 2 分,负者积 0 分。平局时,双方各积 1 分。小组第一名是积分最高的队伍。如果小组中有多支队伍积分并列最高,则在这些并列的队伍中,净胜球数(进球数减去失球数)最多的队伍排名第一。如果该标准仍无法决出胜负,则在积分最高且净胜球数并列最多的队伍中随机抽取一名作为小组第一。两个小组的获胜者将进行世界杯决赛。

Bytean 队是世界杯的夺冠热门。正如预期的那样,他们赢得了小组赛的所有比赛,并确定晋级决赛。与此同时,第二小组的比赛尚未结束,没有任何一支队伍完成了所有比赛。Bytean 队的教练希望开始为决赛做准备。显然,战术取决于对手是谁,因此教练想知道第二小组中还有哪些队伍有机会晋级决赛。由于他不知道如何判断,他请求你的帮助。

输入格式

输入的第一行包含两个整数 $n$ 和 $m$ ($2 \le n \le 100$, $0 \le m \le \frac{n(n-2)}{2}$),分别表示第二小组的队伍数量和已经进行的比赛场数。接下来的 $m$ 行,每行包含四个整数 $a_{i}, b_{i}, p_{i}, q_{i}$ ($1 \le a_{i}, b_{i} \le n$, $a_{i} \neq b_{i}$, $0 \le p_{i}, q_{i} \le 2048$),表示队伍 $a_{i}$ 与队伍 $b_{i}$ 进行了一场比赛,其中 $a_{i}$ 进了 $p_{i}$ 个球,$b_{i}$ 进了 $q_{i}$ 个球。

输出格式

输出的第一行应包含一个递增的序列,列出所有仍有机会赢得第二小组冠军的队伍编号。

样例

输入 1

6 9
1 3 10 15
1 4 1 145
1 5 15 112
1 6 24 25
2 3 14 14
2 4 14 15
2 5 14 16
2 6 17 12
3 6 108 107

输出 1

3 4 5

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.