#include <bits/stdc++.h> #define int long long #define pii pair<int,int> #define all(x) x.begin(),x.end() #define vi vector<int> #define vii vector<pii> #define vb vector<bool> #define siz(x) (int)x.size() #define pb push_back #define nd second #define st first #define rep(i,a,b) for(int i=a; i<=b; i++) using namespace std; const int maxn = 1e6, inf = 1e9, mod = 1e9+7; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n;cin>>n; vii V; rep(i,1,n){ string s;int t; cin>>s>>t; if(s=="TAK"){ V.pb({i,t}); } } rep(i,0,9)cout<<V[i].st<<' '; int ost=10; int take=10; while(take--){ while(V[ost].nd>=2){ost++;} cout<<V[ost].st<<' '; ost++; } }
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 36 37 38 39 40 | #include <bits/stdc++.h> #define int long long #define pii pair<int,int> #define all(x) x.begin(),x.end() #define vi vector<int> #define vii vector<pii> #define vb vector<bool> #define siz(x) (int)x.size() #define pb push_back #define nd second #define st first #define rep(i,a,b) for(int i=a; i<=b; i++) using namespace std; const int maxn = 1e6, inf = 1e9, mod = 1e9+7; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n;cin>>n; vii V; rep(i,1,n){ string s;int t; cin>>s>>t; if(s=="TAK"){ V.pb({i,t}); } } rep(i,0,9)cout<<V[i].st<<' '; int ost=10; int take=10; while(take--){ while(V[ost].nd>=2){ost++;} cout<<V[ost].st<<' '; ost++; } } |