#include <iostream> using namespace std; const int N = 1e5 + 5; int finalisci[20]; int main() { int pos = 0; int n; cin >> n; int x; string s; for (int i=1; i<=n; i++) { if (pos == 20) { break; } cin >> s >> x; if (s == "TAK" and pos < 10) { finalisci[pos] = i; pos += 1; } else if (s == "TAK" and x < 2) { finalisci[pos] = i; pos += 1; } } for (int j=0; j<20; j++) { cout << finalisci[j] << " "; } 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> using namespace std; const int N = 1e5 + 5; int finalisci[20]; int main() { int pos = 0; int n; cin >> n; int x; string s; for (int i=1; i<=n; i++) { if (pos == 20) { break; } cin >> s >> x; if (s == "TAK" and pos < 10) { finalisci[pos] = i; pos += 1; } else if (s == "TAK" and x < 2) { finalisci[pos] = i; pos += 1; } } for (int j=0; j<20; j++) { cout << finalisci[j] << " "; } return 0; } |