Sample Input 1
3 5
2 29 1 wa
2 30 1 ac
2 50 2 ac
1 51 2 ac
3 60 2 ac
Sample Output 1
2 2 100
1 1 51
3 1 60
#include "cstdio"
#include "iostream"
#include "string"
#include "algorithm"
using namespace std;
struct node
{
int idex; //编号
int solve; //解决的题目
int total; //总共的时间
int punish[11]; //题目【i】的罚时
bool p[11]; //题目【i】有没有对过
};
node team[1005];
string res;
int n, m, num, t, pro;
bool cmp(node a, node b);
int main()
{
scanf("%d%d", &n, &m);
for(int i =1; i <= n; i++)
team[i].idex = i;
while(m)
{
scanf("%d%d%d", &num, &t, &pro);//队伍编号, 现在的时间, 尝试的题目
cin >> res; //解题状态
if(res == "ac" && !team[num].p[pro])
{
team[num].solve++;
team[num].total += t + team[num].punish[pro] * 20;
team[num].p[pro] = 1;
}
else
{
team[num].punish[pro]++;
}
m--;
}
sort(team + 1, team + n + 1, cmp);
for(int i = n; i > 0; i--)
printf("%d %d %d\n", team[i].idex, team[i].solve, team[i].total);
return 0;
}
bool cmp(node a, node b)
{
if(a.solve > b.solve)
return a.solve < b.solve;
else if(a.solve == b.solve)
{
if(a.total == b.total)
return a.idex > b.idex;
return a.total < b.total;
}
}