-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1062.cpp
54 lines (54 loc) · 1.27 KB
/
1062.cpp
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
51
52
53
54
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
const int maxn=1e5+10;
int n,l,h,m;
struct ty{
string ID;
int vg;
int tg;
int kind;// 1:sages 2:nobleman 3:fool men 5:small man
bool operator<(const ty& o)const{
if(kind!=o.kind) return kind<o.kind;
if((vg+tg)!=(o.vg+o.tg)) return (vg+tg)>(o.vg+o.tg);
if(vg!=o.vg) return vg>o.vg;
return ID<o.ID;
}
}tmp;
vector<ty>v;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>l>>h;
for(int i=1;i<=n;i++){
cin>>tmp.ID>>tmp.vg>>tmp.tg;
if(tmp.vg<l||tmp.tg<l) continue;
if(tmp.vg>=h&&tmp.tg>=h){
tmp.kind=1;v.push_back(tmp);
continue;
}
if(tmp.vg>=h){
tmp.kind=2;v.push_back(tmp);
continue;
}
if(tmp.tg>=h){
tmp.kind=5;v.push_back(tmp);
continue;
}
if(tmp.vg>=tmp.tg){
tmp.kind=3;v.push_back(tmp);
continue;
}
tmp.kind=5;v.push_back(tmp);
}
sort(v.begin(),v.end());
int len=v.size();
cout<<len<<'\n';
for(int i=0;i<len;i++){
cout<<v[i].ID<<' '<<v[i].vg<<' '<<v[i].tg<<'\n';
}
return 0;
}