QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 10

#10235. 決賽選手 [C]

Statistics

今年你終於決定要參加 Potyczki 的決賽了!在行動之前,先了解決賽的確切資格規則是很值得的。你在競賽規章中找到了以下幾點:

  • 經過五輪遠端賽事後,將有 20 名參賽者獲得決賽資格。其中 10 名是 A+B+C 排名列表上第 1 到第 10 名的選手。接下來的 10 名則是排名列表上後續名次中排名最高的選手,但必須排除掉那些至少參加過兩次 Potyczki Algorytmiczne 決賽的人。
  • 只有具備波蘭公民身份,或是波蘭居民,或是在波蘭學習、讀書或工作的選手才有資格參加決賽。
  • 為了選出 20 名決賽參賽者,首先會從排名中移除那些無法參賽或放棄參賽的選手。接著,從剩餘的選手中,根據上述規則選出 20 名決賽選手。

你的朋友非常了解所有選手,並預測了今年的排名。他給了你一份包含 $n$ 名選手的列表,這些選手按成績從高到低編號為 1 到 $n$(你朋友的列表中沒有平手的情況)。對於每位選手,你知道他是否能夠且願意參加決賽,以及他之前參加過幾次決賽。

請找出根據規章將獲得決賽資格的 20 名選手列表。 你可以假設列表中的選手人數足夠多,能夠根據規章填滿所有 20 個名額。

輸入格式

第一行包含一個整數 $n$ ($20 \le n \le 10\,000$),代表 Potyczki 排名中的選手人數。

接下來的 $n$ 行包含後續選手的資訊。每一行包含一個字串 $s$ 和一個整數 $x$ ($s \in \{\text{TAK}, \text{NIE}\}, 0 \le x < 20$)。字串 TAK 代表該選手能夠且願意參加決賽,字串 NIE 代表該選手不能或不願意參加決賽。數字 $x$ 代表該選手迄今為止參加決賽的次數。

輸出格式

輸出包含一行,由 20 個整數組成,以單空格分隔,代表獲得 Potyczki 決賽資格的選手編號,並按升序排列。

範例

範例 1

輸入

35
NIE 0
NIE 0
TAK 3
TAK 0
TAK 7
TAK 5
NIE 0
NIE 0
TAK 7
TAK 1
NIE 0
TAK 8
TAK 1
TAK 3
NIE 0
TAK 2
NIE 0
TAK 1
NIE 4
TAK 2
TAK 2
TAK 1
TAK 1
TAK 0
TAK 0
TAK 0
TAK 0
TAK 0
NIE 0
TAK 1
TAK 2
TAK 0
TAK 0
TAK 0
TAK 0

輸出

3 4 5 6 9 10 12 13 14 16 18 22 23 24 25 26 27 28 30 32

說明

範例說明:編號為 1, 2, 7, 8, 11, 15, 17, 19, 29 的選手被跳過,因為他們不能/不願意參加決賽。剩餘選手中排名最高的十位選手編號為 3, 4, 5, 6, 9, 10, 12, 13, 14, 16。接著,跳過編號為 20, 21 和 31 的選手(因為他們已經參加過至少兩次決賽),我們得到第二組十位決賽選手,編號為:18, 22, 23*, 24, 25, 26, 27, 28, 30, 32。

*你的朋友預測編號 23 的選手將會贏得決賽!

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.