#include <bits/stdc++.h> using namespace std; int n, k; vector < int > v; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); cin >> n; for (int i = 0; i < n; ++i) { string c; cin >> c >> k; if (v.size() == 20) continue; if ((v.size() < 10 && c[2] == 'K') || (c[2] == 'K' && k < 2)) v.push_back(i + 1); } for (auto & i : v) { cout << i << ' '; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <bits/stdc++.h> using namespace std; int n, k; vector < int > v; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); cin >> n; for (int i = 0; i < n; ++i) { string c; cin >> c >> k; if (v.size() == 20) continue; if ((v.size() < 10 && c[2] == 'K') || (c[2] == 'K' && k < 2)) v.push_back(i + 1); } for (auto & i : v) { cout << i << ' '; } } |