#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct node{
string nam,id;
int gra;
};
bool cmp(node &a,node &b){
return a.gra<b.gra;
}
vector<node>ans,anse;
int main(){
int n,_3;
scanf("%d",&n);
string _1,_2;
for(int i=0;i<n;i++){
cin>>_1>>_2>>_3;
ans.push_back({_1,_2,_3});
}
sort(ans.begin(),ans.end(),cmp);
int lx,rx;
cin>>lx>>rx;
for(int i=n-1;i>=0;i--){
if(ans[i].gra>=lx&&ans[i].gra<=rx){
anse.push_back(ans[i]);
}
}
if(anse.size()==0) printf("NONE\n");
for(int i=0;i<anse.size();i++){
printf("%s %s\n",anse[i].nam.c_str(),anse[i].id.c_str());
}
return 0;
}
to sum up
easier
Note that none is output when there is no
English
The problem is unable to use string instead of char array