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
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <bits/stdc++.h>
using namespace std;

#define all(a) begin(a), end(a)
using ll = long long;

void solve() {
    int n;
    cin >> n;

    vector<pair<bool, int>> a(n);
    for (auto &[b, x] : a) {
        string s;
        cin >> s >> x;
        b = s == "TAK";
    }

    vector<int> res;
    for (int i = 0; i < n; i++) {
        auto [b, x] = a[i];
        if (!b)
            continue;

        if (res.size() < 10) {
            res.push_back(i);
        } else if (res.size() < 20 && x < 2) {
            res.push_back(i);
        }
    }

    assert(res.size() == 20);
    for (auto i : res)
        cout << i + 1 << " ";
    cout << "\n";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int tests = 1;
    // cin >> tests;

    while (tests--)
        solve();
}