#include <bits/stdc++.h> using namespace std; int n; vector<pair<int, int>>a; int main() { cin >> n; int i = 0; while (n--) { i++; string s; int k; cin >> s >> k; if (s == "NIE") continue; a.push_back({k, i}); } for (int i = 0; i < 10; i++) { cout << a[i].second << ' '; } int ile = 10; for (int i = 10; i < a.size(); i++) { if (a[i].first < 2) { ile++; cout << a[i].second << ' '; } if (ile == 20) break; } }
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 | #include <bits/stdc++.h> using namespace std; int n; vector<pair<int, int>>a; int main() { cin >> n; int i = 0; while (n--) { i++; string s; int k; cin >> s >> k; if (s == "NIE") continue; a.push_back({k, i}); } for (int i = 0; i < 10; i++) { cout << a[i].second << ' '; } int ile = 10; for (int i = 10; i < a.size(); i++) { if (a[i].first < 2) { ile++; cout << a[i].second << ' '; } if (ile == 20) break; } } |