简单题
题意:对于一场acm比赛,给出所有提交状况,求排名。注意:提交状况并非按时间顺序。
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
#define maxn 1005
#define maxp 25
struct Team
{
int t, p, id;
}team[maxn];
struct Sub
{
int a, b, c, d;
}sub[maxn];
int n, m;
bool solved[maxn][maxp];
int reject[maxn][maxp];
bool operator < (const Team &a, const Team &b)
{
if (a.p != b.p)
return a.p > b.p;
if (a.t != b.t)
return a.t < b.t;
return a.id < b.id;
}
bool operator < (const Sub &a, const Sub &b)
{
return a.c < b.c;
}
int main()
{
//freopen("t.txt", "r", stdin);
scanf("%d%d", &n, &m);
memset(solved, 0, sizeof(solved));
memset(reject, 0, sizeof(reject));
memset(team, 0, sizeof(team));
for (int i = 1; i <= n; i++)
team[i].id = i;
for (int i = 0; i < m; i++)
scanf("%d%d%d%d", &sub[i].a, &sub[i].b, &sub[i].c, &sub[i].d);
sort(sub, sub + m);
for (int i = 0; i < m; i++)
{
int a, b, c, d;
a = sub[i].a;
b = sub[i].b;
c = sub[i].c;
d = sub[i].d;
if (solved[a][b])
continue;
if (d)
{
solved[a][b] = true;
team[a].t += c + reject[a][b] * 20 * 60;
team[a].p++;
}else
reject[a][b]++;
}
sort(team + 1, team + n + 1);
printf("%d", team[1].id);
for (int i = 2; i <= n; i++)
printf(" %d", team[i].id);
putchar('\n');
return 0;
}