#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
struct T {
int n;
int won;
T(int nn, int wwon) {
n = nn;
won = wwon;
}
};
int main() {
int n; scanf(" %d", &n);
char s[20]; int x;
vector<T> t;
for (int i=0; i<n; ++i) {
scanf(" %s %d", s, &x);
if (strcmp(s, "TAK") == 0) t.emplace_back(i+1, x);
}
int selected = 0;
for (int i=0; i<t.size(); ++i) {
if (selected < 10) {
printf("%d ", t[i].n);
++selected;
} else if (selected < 20 && t[i].won < 2) {
printf("%d ", t[i].n);
++selected;
}
}
printf("\n");
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 34 35 36 37 38 39 | #include <cstdio> #include <vector> #include <cstring> using namespace std; struct T { int n; int won; T(int nn, int wwon) { n = nn; won = wwon; } }; int main() { int n; scanf(" %d", &n); char s[20]; int x; vector<T> t; for (int i=0; i<n; ++i) { scanf(" %s %d", s, &x); if (strcmp(s, "TAK") == 0) t.emplace_back(i+1, x); } int selected = 0; for (int i=0; i<t.size(); ++i) { if (selected < 10) { printf("%d ", t[i].n); ++selected; } else if (selected < 20 && t[i].won < 2) { printf("%d ", t[i].n); ++selected; } } printf("\n"); return 0; } |
English