#include <bits/stdc++.h> #define ndl '\n' #define ll long long #define st first #define nd second #define debug(x) cout << #x << ": " << x << ndl #define all(x) (x).begin(), (x).end() using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; vector<int> ans; for(int i=1;i<=n;i++) { string czy; int ile; cin>>czy>>ile; if(ans.size() < 20 && czy == "TAK" && (ans.size()<10 || ile < 2)) { ans.push_back(i); } } for(auto x:ans) cout<<x<<" "; }
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 | #include <bits/stdc++.h> #define ndl '\n' #define ll long long #define st first #define nd second #define debug(x) cout << #x << ": " << x << ndl #define all(x) (x).begin(), (x).end() using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; vector<int> ans; for(int i=1;i<=n;i++) { string czy; int ile; cin>>czy>>ile; if(ans.size() < 20 && czy == "TAK" && (ans.size()<10 || ile < 2)) { ans.push_back(i); } } for(auto x:ans) cout<<x<<" "; } |