/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <vector>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
vector<pair<int,int>> liczbastart;
for(int y=1;y<=n;y++){
string a;
cin>>a;
int q;
cin>>q;
if(a=="TAK"){
liczbastart.push_back({y,q});
}
}
long long counter = 0;
for(int y=0;y<liczbastart.size();y++){
if(counter<10){
cout<<liczbastart[y].first<<" ";
counter++;
}
else if(counter<20){
if(liczbastart[y].second<2){
cout<<liczbastart[y].first<<" ";
counter++;
}
}
}
//3 4 5 6 9 10 12 13 14 16 18 22 23 24 25 26 27 28 30 32
return 0;
}
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 | /****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <vector> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin>>n; vector<pair<int,int>> liczbastart; for(int y=1;y<=n;y++){ string a; cin>>a; int q; cin>>q; if(a=="TAK"){ liczbastart.push_back({y,q}); } } long long counter = 0; for(int y=0;y<liczbastart.size();y++){ if(counter<10){ cout<<liczbastart[y].first<<" "; counter++; } else if(counter<20){ if(liczbastart[y].second<2){ cout<<liczbastart[y].first<<" "; counter++; } } } //3 4 5 6 9 10 12 13 14 16 18 22 23 24 25 26 27 28 30 32 return 0; } |
English