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
#include <bits/stdc++.h>
using namespace std;
long long int n, a,z;
string s;
long long int tab[10007];
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(int i=0;i<n;++i)
    {
        cin>>s>>a;
        if(z<10 && s[0]=='T' && z<20)
        {
            tab[z]=i;
            ++z;
        }
        else if(z>=10 && s[0]=='T' && a<2 && z<20)
        {
            tab[z]=i;
            ++z;
        }
    }
    for(int i=0;i<z;++i)
    {
        cout<<tab[i]+1<<" ";
    }
}