#include <cstdio> #include <vector> #include <map> using namespace std; int ma[8000]; int mh[8000]; int main() { int n, k; char c[10]; vector<int> res; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%s %d", c, &k); if (c[0] == 'T' && res.size() < 10) { res.push_back(i); } else if (c[0] == 'T' && res.size() < 20 && k<2) { res.push_back(i); } } for (int i = 0; i < 20; i++) { printf("%d ", res[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 34 35 36 37 38 39 | #include <cstdio> #include <vector> #include <map> using namespace std; int ma[8000]; int mh[8000]; int main() { int n, k; char c[10]; vector<int> res; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%s %d", c, &k); if (c[0] == 'T' && res.size() < 10) { res.push_back(i); } else if (c[0] == 'T' && res.size() < 20 && k<2) { res.push_back(i); } } for (int i = 0; i < 20; i++) { printf("%d ", res[i]); } return 0; } |