#include <bits/stdc++.h> using namespace std; int main() { int n, y = 0; cin >> n; vector<bool> v(n+1, 1); for(int i = 1; i <=n; i++){ string s; int x; cin >> s >> x; if(s == "NIE")v[i] = 0; else if(y <= 10) y++; if(y> 10 && x > 1) v[i] = 0; } y = 0; for(int i = 1; i <= n; i++){ if(y==20) break; if(v[i] == 1){ cout << i << ' '; y++;} } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <bits/stdc++.h> using namespace std; int main() { int n, y = 0; cin >> n; vector<bool> v(n+1, 1); for(int i = 1; i <=n; i++){ string s; int x; cin >> s >> x; if(s == "NIE")v[i] = 0; else if(y <= 10) y++; if(y> 10 && x > 1) v[i] = 0; } y = 0; for(int i = 1; i <= n; i++){ if(y==20) break; if(v[i] == 1){ cout << i << ' '; y++;} } } |