#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> odp;
for(int i=1; i<=n; i++){
string s;
cin >> s;
int ile;
cin >> ile;
if(s == "TAK"){
if(odp.size()<10 || (ile<2 && odp.size()<20)) odp.push_back(i);
}
}
for(auto e : odp) cout << e << " ";
cout << "\n";
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> odp; for(int i=1; i<=n; i++){ string s; cin >> s; int ile; cin >> ile; if(s == "TAK"){ if(odp.size()<10 || (ile<2 && odp.size()<20)) odp.push_back(i); } } for(auto e : odp) cout << e << " "; cout << "\n"; } |
English