-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaoj1187.cpp
More file actions
76 lines (74 loc) · 1.43 KB
/
aoj1187.cpp
File metadata and controls
76 lines (74 loc) · 1.43 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
const int INF = 1<<28;
struct team {
int no, ac, wa[10], time;
bool operator < (const team& a) const {
if(ac == a.ac) {
if(time == a.time)
return no > a.no;
else
return time < a.time;
}
else
return ac > a.ac;
}
};
int main() {
int M, T, P, R;
while(cin >> M >> T >> P >> R, M|T|P|R) {
vector<team> vt;
REP(i, T) {
team t;
t.no = i + 1;
t.ac = t.time = 0;
memset(t.wa, 0, sizeof(t.wa));
vt.push_back(t);
}
REP(i, R) {
int m, t, p, j;
cin >> m >> t >> p >> j;
if(j)
vt[t-1].wa[p-1]++;
else {
vt[t-1].ac++;
vt[t-1].time += m + vt[t-1].wa[p-1] * 20;
}
}
sort(vt.begin(), vt.end());
int a = vt[0].ac, t = vt[0].time;
cout << vt[0].no;
FOR(i, 1, vt.size()) {
if(vt[i].ac == a && vt[i].time == t)
cout << '=';
else {
a = vt[i].ac;
t = vt[i].time;
cout << ',';
}
cout << vt[i].no;
}
cout << endl;
// REP(i, vt.size()) cout << vt[i].no << ' ' << vt[i].ac << ' ' << vt[i].time << endl;
}
return 0;
}