#include <bits/stdc++.h> #define ll long long #define range(i, n) for (int i = 0; i < n; i++) using namespace std; struct person { bool chce; int finaly; }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<person> v(n); range(i, n) { string s; int x; cin >> s >> x; v[i] = {s == "TAK", x}; } for (int i = 0, left = 10; i < n && left > 0; i++) if (v[i].chce) { v[i].chce = false; cout << i + 1 << " "; left--; } for (int i = 10, left = 10; i < n && left > 0; i++) if (v[i].chce && v[i].finaly < 2) { v[i].chce = false; cout << i + 1 << " "; left--; } cout << "\n"; }
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 | #include <bits/stdc++.h> #define ll long long #define range(i, n) for (int i = 0; i < n; i++) using namespace std; struct person { bool chce; int finaly; }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<person> v(n); range(i, n) { string s; int x; cin >> s >> x; v[i] = {s == "TAK", x}; } for (int i = 0, left = 10; i < n && left > 0; i++) if (v[i].chce) { v[i].chce = false; cout << i + 1 << " "; left--; } for (int i = 10, left = 10; i < n && left > 0; i++) if (v[i].chce && v[i].finaly < 2) { v[i].chce = false; cout << i + 1 << " "; left--; } cout << "\n"; } |