-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathA1062.cpp
48 lines (46 loc) · 1.02 KB
/
A1062.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
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
struct Persion{
char id[12];
int virtue, talent, total, level;
bool operator < (const Persion &p) const{
if(level != p.level) return level > p.level;
else if(total != p.total) return total > p.total;
else if(virtue != p.virtue) return virtue > p.virtue;
else return strcmp(id, p.id) < 0;
}
} men[100010];
int main(){
int N, L, H;
int cnt = 0;
scanf("%d%d%d", &N, &L, &H);
for(int i = 0; i < N; ++i){
char id[12];
int v, t;
scanf("%s%d%d", id, &v, &t);
if(v >= L && t >= L){
strcpy(men[cnt].id, id);
men[cnt].virtue = v;
men[cnt].talent = t;
men[cnt].total = v + t;
if(v >= H && t >= H){
men[cnt].level = 4;
}else if(v >= H && t < H){
men[cnt].level = 3;
}else if(v >= t){
men[cnt].level = 2;
}else{
men[cnt].level = 1;
}
++cnt;
}
}
printf("%d\n", cnt);
sort(men, men+cnt);
for(int i = 0; i < cnt; ++i){
printf("%s %d %d\n", men[i].id, men[i].virtue, men[i].talent);
}
return 0;
}