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