-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10258.cpp
77 lines (75 loc) · 1.49 KB
/
10258.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
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <string>
using namespace std;
struct Player{
int id,p,time;
bool print;
vector<bool> pro;
vector<int> timeP;
bool operator<(const Player&o)const
{
if(this->p==o.p && this->time==o.time)
return this->id<o.id;
if( this->p==o.p )
return this->time<o.time;
return this->p > o.p;
}
};
int main()
{
int n;
string line;
scanf("%d",&n);
int c,p,t;
char pp;
cin.ignore();
getline(cin,line);
vector<Player> players(100);
while(n--)
{
Player temp;
temp.p=0;
temp.print=false;
temp.time=0;
temp.pro=vector<bool>(10,false);
temp.timeP=vector<int>(10,0);
for( int i =0 ;i < 100 ; ++i )
{
temp.id=i+1;
players[i]=temp;
}
while( getline(cin,line) && line!="")
{
stringstream s;
s<<line;
s>>c>>p>>t>>pp;
c--;
// cout<<c<<" num "<<endl;
players[c].print=true;
if( pp=='I')
{
players[c].timeP[p]+=20;
}
else if(pp=='C' && !players[c].pro[p] )
{
players[c].pro[p] =true;
players[c].p++;
players[c].time+=(players[c].timeP[p]+t);
}
}
sort(players.begin(),players.end());
for( int i = 0 ; i < 100 ; ++i )
{
// cout<<players[c].print<<" -- "<<endl;
if(players[i].print)
{
printf("%d %d %d\n",players[i].id,players[i].p,players[i].time);
}
}
if(n!=0)printf("\n");
}
return 0;
}