-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA1028.cpp
More file actions
31 lines (31 loc) · 684 Bytes
/
A1028.cpp
File metadata and controls
31 lines (31 loc) · 684 Bytes
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
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
const int maxn = 100001;
struct NODE {
int no;
char name[10];
int score;
}node[maxn];
int c;
int cmp1(NODE a, NODE b) {
if(c == 1)
return a.no < b.no;
else if(c == 2)
return strcmp(a.name, b.name) <= 0;
else
return a.score <= b.score;
}
int main() {
int n;
scanf("%d%d", &n, &c);
for(int i = 0; i < n; i++) {
scanf("%d %s %d", &node[i].no, node[i].name, &node[i].score);
}
sort(node, node + n, cmp1);
for(int i = 0; i < n; i++) {
printf("%06d %s %d\n", node[i].no, node[i].name, node[i].score);
}
return 0;
}