-
Notifications
You must be signed in to change notification settings - Fork 0
/
10825.cpp
47 lines (43 loc) · 1004 Bytes
/
10825.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
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct student {
string name;
int a, b, c;
};
bool cmp(const student &s1, const student &s2) {
if (s1.a > s2.a)
return true;
else if (s1.a == s2.a) {
if (s1.b < s2.b)
return true;
else if (s1.b == s2.b) {
if (s1.c > s2.c)
return true;
else if (s1.c == s2.c) {
if (s1.name < s2.name)
return true;
else
return false;
} else
return false;
} else
return false;
} else
return false;
}
int main() {
vector<student> v;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
student s;
cin >> s.name >> s.a >> s.b >> s.c;
v.push_back(s);
}
sort(v.begin(), v.end(), cmp);
for (int i = 0; i < n; i++) cout << v[i].name << "\n";
return 0;
}