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
33
#include <bits/stdc++.h>

constexpr int N = 10004;
int n;
std::vector<int> participants;

int want(std::string b) {
    return (b == "NIE") ? 0 : 1;
}

constexpr int FINALIST_NUM = 20;
int total_winners = 0;

int main() {
    std::cin >> n;
    for (int idx = 0; idx < n; ++idx) {
        std::string w;
        int fin_participations;
        std::cin >> w >> fin_participations;
        if (!want(w)) {
            continue;
        }
        if (fin_participations >= 2 && total_winners >= 10) {
            continue;
        }
        total_winners += 1;
        participants.push_back(idx);
    }

    for (int idx = 0; idx < FINALIST_NUM; ++idx) {
        std::cout << participants[idx] + 1 << ' ';
    }
}