#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; void solve() { int n; cin>>n; vector<pii> v; for (int i=1; i<=n; ++i) { string s; cin>>s; int x; cin>>x; if (s == "NIE") continue; v.push_back({x, i}); } vector<int> ans; for (auto u : v) { if ((int)ans.size() == 20) break; if ((int)ans.size() < 10) { ans.push_back(u.second); } else { if (u.first < 2) ans.push_back(u.second); } } for (auto u : ans) cout<<u<<" "; } int main() { int t=1; //cin>>t; while (t--) solve(); }
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 | #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; void solve() { int n; cin>>n; vector<pii> v; for (int i=1; i<=n; ++i) { string s; cin>>s; int x; cin>>x; if (s == "NIE") continue; v.push_back({x, i}); } vector<int> ans; for (auto u : v) { if ((int)ans.size() == 20) break; if ((int)ans.size() < 10) { ans.push_back(u.second); } else { if (u.first < 2) ans.push_back(u.second); } } for (auto u : ans) cout<<u<<" "; } int main() { int t=1; //cin>>t; while (t--) solve(); } |