#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
struct participant {
int place, prev_finals;
};
string a;
int n, b;
vector <participant> v1;
vector <int> res;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a >> b;
if (a == "TAK") {
v1.push_back({i, b});
}
}
int count = 0;
for(auto i : v1) {
if (count == 20) break;
if (count < 10) {
res.push_back(i.place);
count++;
} else if (count >= 10 && i.prev_finals < 2) {
res.push_back(i.place);
count++;
}
}
for (auto i : res) {
cout << i << " ";
}
}
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 34 35 36 37 38 | #include <bits/stdc++.h> using namespace std; const int N = 1e4 + 5; struct participant { int place, prev_finals; }; string a; int n, b; vector <participant> v1; vector <int> res; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a >> b; if (a == "TAK") { v1.push_back({i, b}); } } int count = 0; for(auto i : v1) { if (count == 20) break; if (count < 10) { res.push_back(i.place); count++; } else if (count >= 10 && i.prev_finals < 2) { res.push_back(i.place); count++; } } for (auto i : res) { cout << i << " "; } } |
English