QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB

#23985. 体育大会

Statistics

题目描述

将举办一场有 $32$ 支队伍参加的体育大会。每支队伍都编有从 $1$ 到 $32$ 的编号。

队伍 $i$($1 \le i \le 32$)的实力为 $A_i$,且所有队伍的实力互不相同。当 $2$ 支队伍进行比赛时,实力较大的队伍必定获胜。

大会采用共 $5$ 轮的淘汰赛制进行。

在第 $1$ 轮开始时,各支队伍从左到右按队伍 $1, 2, \dots, 32$ 的顺序排成一排。

在每一轮中,从左往右依次每相邻的 $2$ 支队伍组成一组,分别进行比赛。当该轮的所有比赛结束后,只有每场比赛的胜者晋级下一轮。胜者们按照本轮比赛进行的顺序从左往右排成一排,晋级下一轮。

重复这一操作直到只剩下 $1$ 支队伍为止。在第 $5$ 轮中会剩下 $2$ 支队伍并进行比赛。这场比赛称为决赛,在决赛中获胜的队伍获得冠军,落败的队伍获得亚军。

求在作为决赛的第 $5$ 轮比赛中落败并获得亚军的队伍编号。

数据范围

  • $1 \le A_i \le 1\,000$($1 \le i \le 32$)。
  • $A_i \ne A_j$($1 \le i < j \le 32$)。
  • 输入的所有值均为整数。

输入格式

输入按以下格式给出:

A_1 A_2 … A_32

输出格式

输出获得亚军的队伍编号。

除答案外不要输出任何内容。(也不要输出提示输入的文字等。)

关于作答格式,可以参考练习题及其解答示例。

样例 1

输入

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

输出

16

在第 $5$ 轮比赛中,队伍 $16$ 与队伍 $32$ 进行比赛。因为队伍 $16$ 的实力为 $A_{16} = 16$,队伍 $32$ 的实力为 $A_{32} = 32$,所以队伍 $32$ 获胜,队伍 $16$ 获得亚军。因此输出 $16$。

样例 2

输入

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

输出

25

在第 $5$ 轮比赛中,队伍 $11$ 与队伍 $25$ 进行比赛。因为队伍 $11$ 的实力为 $A_{11} = 32$,队伍 $25$ 的实力为 $A_{25} = 31$,所以队伍 $11$ 获胜,队伍 $25$ 获得亚军。因此输出 $25$。

样例 3

输入

19 2 5 12 44 40 24 16 3 26 23 21 41 28 9 39 43 22 15 14 7 49 17 46 34 4 32 30 45 27 33 36

输出

5

在第 $5$ 轮比赛中,队伍 $5$ 与队伍 $22$ 进行比赛。因为队伍 $5$ 的实力为 $A_5 = 44$,队伍 $22$ 的实力为 $A_{22} = 49$,所以队伍 $22$ 获胜,队伍 $5$ 获得亚军。因此输出 $5$。

样例 4

输入

538 714 395 303 912 315 903 629 588 760 590 344 794 577 541 193 404 325 544 536 435 975 340 511 806 769 44 95 741 519 332 973

输出

5

在第 $5$ 轮比赛中,队伍 $5$ 与队伍 $22$ 进行比赛。因为队伍 $5$ 的实力为 $A_5 = 912$,队伍 $22$ 的实力为 $A_{22} = 975$,所以队伍 $22$ 获胜,队伍 $5$ 获得亚军。因此输出 $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.