#include <bits/stdc++.h> using namespace std; #define long long int int l, n; vector<int> num, s, f; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; i++){ string st; int x; cin >> st >> x; if (st == "TAK"){ num.push_back(i); s.push_back(x);} } for (int i = 0; i < 10; i++)f.push_back(num[i]); for (int i = 10; i < num.size(); i++){ if (s[i] < 2 && l < 10){ f.push_back(num[i]); l++; } } sort(f.begin(), f.end()); for (int i = 0; i < 20; i++)cout << f[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 | #include <bits/stdc++.h> using namespace std; #define long long int int l, n; vector<int> num, s, f; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; i++){ string st; int x; cin >> st >> x; if (st == "TAK"){ num.push_back(i); s.push_back(x);} } for (int i = 0; i < 10; i++)f.push_back(num[i]); for (int i = 10; i < num.size(); i++){ if (s[i] < 2 && l < 10){ f.push_back(num[i]); l++; } } sort(f.begin(), f.end()); for (int i = 0; i < 20; i++)cout << f[i] << " "; return 0; } |