#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false), cin.tie(nullptr);
int N;
cin >> N;
vector<pair<int, int> > people;
for(int i = 0; i < N; i++){
string s;
int x;
cin >> s >> x;
if(s == "TAK"){
people.push_back({x, i});
}
}
vector<int> v;
for(int i = 0; i < (int)people.size(); i++){
if(v.size() < 10 || (v.size() < 20 && people[i].first < 2)){
v.push_back(people[i].second);
}
}
for(int i = 0; i < 20; i++){
cout << (v[i]+1) << " \n"[i+1 == 20];
}
}
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 | #include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false), cin.tie(nullptr); int N; cin >> N; vector<pair<int, int> > people; for(int i = 0; i < N; i++){ string s; int x; cin >> s >> x; if(s == "TAK"){ people.push_back({x, i}); } } vector<int> v; for(int i = 0; i < (int)people.size(); i++){ if(v.size() < 10 || (v.size() < 20 && people[i].first < 2)){ v.push_back(people[i].second); } } for(int i = 0; i < 20; i++){ cout << (v[i]+1) << " \n"[i+1 == 20]; } } |
English