1083. List Grades

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
struct node
{
    node(){}
    node(int x):goal(x){}
    string name,id;int goal;
    bool operator<(const node&x)const{return goal<x.goal;}
};
int main()
{
    int n;cin>>n;
    vector<node>st(n);
    for(int i=0;i<n;++i)
        cin>>st[i].name>>st[i].id>>st[i].goal;
    sort(st.begin(),st.end());
    int x,y;cin>>x>>y;
    auto be=lower_bound(st.begin(),st.end(),node(x));
    auto en=upper_bound(st.begin(),st.end(),node(y));
    if(be==en)cout<<"NONE";
    else
        while(--en>=be)
            cout<<en->name<<' '<<en->id<<endl;
    return 0;
}

你可能感兴趣的:(1083. List Grades)