Note
Code:
#include<bits/stdc++.h>
using namespace std;
struct people{
string id;
int de,tt,total;
};
bool compare(people a,people b){
if(a.total!=b.total) return a.total>b.total;
else if(a.de!=b.de) return a.de>b.de;
else return a.id<b.id;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("data.txt","r",stdin);
#endif
int n,l,h;
struct people p;
vector<vector<people>> vt(4);
cin>>n>>l>>h;
int count=n;
for(int i=0;i<n;i++){
cin>>p.id>>p.de>>p.tt;
p.total=p.de+p.tt;
if(p.de<l||p.tt<l)
count--;
else if(p.de>=h&&p.tt>=h)
vt[0].push_back(p);
else if(p.de>=h&&p.tt<h)
vt[1].push_back(p);
else if(p.de<h&&p.tt<h&&p.de>=p.tt)
vt[2].push_back(p);
else
vt[3].push_back(p);
}
cout<<count<<endl;
for(int i=0;i<4;i++){
sort(vt[i].begin(),vt[i].end(),compare);
for(int j=0;j<vt[i].size();j++){
cout<<vt[i][j].id<<" "<<vt[i][j].de<<" "<<vt[i][j].tt<<endl;
}
}
return 0;
}