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

using namespace std;

int main(){
    
    int n;
    pair<bool, int>* arr;
    string str;
    
    cin >> n;
    
    arr = new pair<bool, int>[n];
    for(int i = 0; i < n; ++i){
        cin >> str >> arr[i].second;
        if(str == "NIE"){
            arr[i].first = false;
        }
        else{
            arr[i].first = true;
        }
    }
    
    for(int i = 0, x = 0; x < 20; ++i){
        if(arr[i].first){
            if(x < 10){
                cout << i + 1 << ' ';
                x ++;
            }
            else{
                if(arr[i].second < 2){
                    cout << i + 1 << ' ';
                    ++x;
                }
            }
        }
    }
    
    return 0;
}