#include <bits/stdc++.h>
#define ull unsigned long long
#define pb push_back
#define pg push_front
#define in insert
#define f first
#define s second
#define pii pair<int, int>
#define pib pair<int, bool>
#define cint const int
#define mn2 262144
#define nw '\n'
#define sp " "
#define mn 200009
#define inf 400009
using namespace std;
int n, cnt=0, l=0;
vector<pii> v;
bool bysec(const pii& a, const pii& b){
return a.s<b.s;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string a;
int b;
cin>>n;
while(n--){
cin>>a>>b;
cnt++;
if(a!="NIE"){
if(l>=10){
if(b<2) v.pb({b, cnt});
}
else v.pb({b, cnt});
++l;
}
}
// if(v.size()>20){
// for(int i=0; i<9; ++i) cout<<v[i].s<<" ";
// for(int i=9; i<v.size(); ++i){
// if(v[i].f<2){
// cout<<v[i].s<<" ";
// ++l;
// }
// if(l>=10) break;
// }
// }
//sort(v.begin(), v.end(), bysec);
for(int i=0; i<20; ++i) cout<<v[i].s<<" ";
}
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 41 42 43 44 45 46 47 48 49 50 | #include <bits/stdc++.h> #define ull unsigned long long #define pb push_back #define pg push_front #define in insert #define f first #define s second #define pii pair<int, int> #define pib pair<int, bool> #define cint const int #define mn2 262144 #define nw '\n' #define sp " " #define mn 200009 #define inf 400009 using namespace std; int n, cnt=0, l=0; vector<pii> v; bool bysec(const pii& a, const pii& b){ return a.s<b.s; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string a; int b; cin>>n; while(n--){ cin>>a>>b; cnt++; if(a!="NIE"){ if(l>=10){ if(b<2) v.pb({b, cnt}); } else v.pb({b, cnt}); ++l; } } // if(v.size()>20){ // for(int i=0; i<9; ++i) cout<<v[i].s<<" "; // for(int i=9; i<v.size(); ++i){ // if(v[i].f<2){ // cout<<v[i].s<<" "; // ++l; // } // if(l>=10) break; // } // } //sort(v.begin(), v.end(), bysec); for(int i=0; i<20; ++i) cout<<v[i].s<<" "; } |
English