QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#9308. 世界杯

Statistics

中国队正在参加 4202 年国际足联世界杯,共有 32 支球队参赛,其中中国队编号为 1,每支球队都有一个唯一的实力值 $a_i$。任意两队之间的比赛,实力值较高的球队获胜。

在小组赛阶段,32 支球队将被分为 8 个小组,每组 4 支球队,进行单循环赛,每支球队需要与同组的其他 3 支球队各进行一场比赛。小组排名依据胜场数决定。每组前两名将晋级淘汰赛。

淘汰赛阶段为单败淘汰制,球队之间进行单场决胜负的比赛。淘汰赛从十六强赛开始,每组的第一名对阵另一组的第二名。随后依次进行四分之一决赛、半决赛和决赛。

具体而言,记 A1 为 A 组第一名,C2 为 C 组第二名,以此类推。十六强赛的对阵为:(1).A1 对阵 B2,(2).C1 对阵 D2,(3).E1 对阵 F2,(4).G1 对阵 H2,(5).B1 对阵 A2,(6).D1 对阵 C2,(7).F1 对阵 E2,(8).H1 对阵 G2。

随后,四分之一决赛的对阵为:(9).(1) 的胜者对阵 (2) 的胜者,(10).(3) 的胜者对阵 (4) 的胜者,(11).(5) 的胜者对阵 (6) 的胜者,(12).(7) 的胜者对阵 (8) 的胜者。

半决赛的对阵为:(13).(9) 的胜者对阵 (10) 的胜者,(14).(11) 的胜者对阵 (12) 的胜者。

决赛的对阵为:(15).(13) 的胜者对阵 (14) 的胜者。

给定每支球队的实力值 $a_1, \dots, a_{32}$,假设你可以操纵分组方案,中国队能取得的最好成绩是什么?具体输出:

  • 1:如果中国队获得冠军,
  • 2:如果中国队在决赛中落败,
  • 4:如果中国队在半决赛中落败,
  • 8:如果中国队在四分之一决赛中落败,
  • 16:如果中国队在十六强赛中落败,
  • 32:如果中国队未能晋级淘汰赛。

输入格式

每个测试点包含多个测试用例。第一行包含测试用例数量 $t(1 \le t \le 10^3)$。接下来是各测试用例的描述。

每个测试用例仅一行,包含 32 个不同的整数,表示 $a_1, \dots, a_{32}(1 \le a_i \le 10^9)$。

输出格式

对于每个测试用例,输出一行一个整数,表示问题的答案。

样例

输入 1

1
32 31 30 29 28 27 26 25 24 23 22 21 20
19 18 17 16 15 14 13 12 11 10 9 8 7 6
5 4 3 2 1

输出 1

1

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.