#include <iostream> #include <vector> using namespace std; int main() { int n,x=1; vector <int> s; cin>>n; pair<string,int> t[n+1]; for(int i=1;i<n+1;i++) { cin>>t[i].first; cin>>t[i].second; } while(s.size()!=10) { if(t[x].first=="TAK") s.push_back(x); x++; } while(s.size()!=20) { if(t[x].first=="TAK" && t[x].second<2) s.push_back(x); x++; } for(int i:s) cout<<i<<" "; 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 | #include <iostream> #include <vector> using namespace std; int main() { int n,x=1; vector <int> s; cin>>n; pair<string,int> t[n+1]; for(int i=1;i<n+1;i++) { cin>>t[i].first; cin>>t[i].second; } while(s.size()!=10) { if(t[x].first=="TAK") s.push_back(x); x++; } while(s.size()!=20) { if(t[x].first=="TAK" && t[x].second<2) s.push_back(x); x++; } for(int i:s) cout<<i<<" "; return 0; } |