#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define ll long long const int MAXN = 1e4 + 5; pair<string, int> tab[MAXN]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=1; i<=n; i++){ string s; int x; cin>>s>>x; tab[i] = {s, x}; } int licz = 0; for(int i=1; i<=n; i++){ if(licz < 10){ if(tab[i].fi == "TAK"){ cout<<i<<" "; licz ++; } } else if(licz < 20){ if(tab[i].fi == "TAK" && tab[i].se < 2){ cout<<i<<" "; licz++; } } else{ return 0; } } }
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 47 48 49 | #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define ll long long const int MAXN = 1e4 + 5; pair<string, int> tab[MAXN]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=1; i<=n; i++){ string s; int x; cin>>s>>x; tab[i] = {s, x}; } int licz = 0; for(int i=1; i<=n; i++){ if(licz < 10){ if(tab[i].fi == "TAK"){ cout<<i<<" "; licz ++; } } else if(licz < 20){ if(tab[i].fi == "TAK" && tab[i].se < 2){ cout<<i<<" "; licz++; } } else{ return 0; } } } |