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
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n; cin>>n;
    string s; int x;
    vector<int>res;
    vector<pair<int,int>>kol;
    for(int i=1; n>=i; i++){
        cin>>s>>x;
        if(s[0] == 'N') continue;
        if(res.size() < 10){
            res.push_back(i);
        }else if(x == 1 or x == 0){
            kol.push_back({x,i});
        }
    }
    vector<int>res2;
    for(auto x : res){
        res2.push_back(x);
    }
    for(int i=0; 10>i; i++){
        res2.push_back(kol[i].second);
    }
    sort(res2.begin(),res2.end());
    for(auto x : res2){
        cout<<x<<" ";
    }
}