#include <bits/stdc++.h> using namespace std; typedef long long ll; int N; vector< int > odp; int main() { cin >> N; for(int i = 1; i <= N; i++){ string s; int x; cin >> s >> x; if(odp.size() >= 20) continue; if(s == "TAK"){ if(odp.size() < 10){ odp.push_back(i); }else if( x <= 1 ){ odp.push_back(i); } } } for( auto el : odp ){ cout << el <<" "; } 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 | #include <bits/stdc++.h> using namespace std; typedef long long ll; int N; vector< int > odp; int main() { cin >> N; for(int i = 1; i <= N; i++){ string s; int x; cin >> s >> x; if(odp.size() >= 20) continue; if(s == "TAK"){ if(odp.size() < 10){ odp.push_back(i); }else if( x <= 1 ){ odp.push_back(i); } } } for( auto el : odp ){ cout << el <<" "; } return 0; } |