-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path10258 - Contest Scoreboard.cpp
82 lines (69 loc) · 1.64 KB
/
10258 - Contest Scoreboard.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
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
77
78
79
80
81
82
#include<stdio.h>
#include<cstring>
#include<set>
#include<algorithm>
using namespace std;
struct data
{
int id,pal[11],solve[11],tl_pal,sub;
set<int>s;
};
bool comp(data a,data b)
{
if(a.s.size()==b.s.size())
{
if(a.tl_pal==b.tl_pal)
return a.id<b.id;
return (a.tl_pal<b.tl_pal);
}
return (a.s.size()>b.s.size());
}
data vec[102];
int main()
{
//freopen ("in.txt", "r", stdin);
int t,i,j,k,l;
int id,prb,pal;
char ver,ar[250];
scanf("%d\n",&t);
while(t--)
{
for(i=0; i<101; i++)
{
memset(vec[i].pal,0,sizeof(vec[i].pal));
memset(vec[i].solve,0,sizeof(vec[i].solve));
vec[i].tl_pal=0;
vec[i].sub=0;
vec[i].s.clear();
}
while(gets(ar) && ar[0]!='\0')
{
sscanf(ar,"%d %d %d %c",&id,&prb,&pal,&ver);
vec[id].id=id;
vec[id].sub++;
if(ver=='C')
{
if(!vec[id].solve[prb])
{
vec[id].solve[prb]=1;
vec[id].tl_pal+=pal+(vec[id].pal[prb]*20);
vec[id].s.insert(prb);
}
}
else if(ver=='I' && vec[id].solve[prb]==0)
vec[id].pal[prb]++;
}
// for(i=0;i<9;i++)
// printf("%d ",vec[1].pal[i]);
// printf("\n");
sort(vec,vec+101,comp);
for(i=0; i<101; i++)
{
if(vec[i].sub>0)
printf("%d %d %d\n",vec[i].id,vec[i].s.size(),vec[i].tl_pal);
}
if(t>0)
printf("\n");
}
return 0;
}