#include <bits/stdc++.h> using namespace std; const string TAK = "TAK"; const string NIE = "NIE"; const int TEN = 10; const int TWENTY = 20; int main() { // ifstream cin("tests/0a.in"); // ifstream cin("tests1/r1c001.in"); cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false); int n, x; cin >> n; string s; vector<int> numbers; for (int i = 1; i <= n; i++) { if (numbers.size() == TWENTY) { break; } cin >> s; cin >> x; if (s == NIE) { continue; } if (numbers.size() < TEN) { numbers.push_back(i); } else if (x < 2) { numbers.push_back(i); } } for (int i = 0; i < TWENTY; i++) { cout << numbers[i] << " "; } cout << endl; 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 40 41 42 43 44 | #include <bits/stdc++.h> using namespace std; const string TAK = "TAK"; const string NIE = "NIE"; const int TEN = 10; const int TWENTY = 20; int main() { // ifstream cin("tests/0a.in"); // ifstream cin("tests1/r1c001.in"); cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false); int n, x; cin >> n; string s; vector<int> numbers; for (int i = 1; i <= n; i++) { if (numbers.size() == TWENTY) { break; } cin >> s; cin >> x; if (s == NIE) { continue; } if (numbers.size() < TEN) { numbers.push_back(i); } else if (x < 2) { numbers.push_back(i); } } for (int i = 0; i < TWENTY; i++) { cout << numbers[i] << " "; } cout << endl; return 0; } |