水~。
const int N=1e5+10;
struct Node
{
int scoreb,scorea,scoret;
int score;
int cnt;
int rank;
string school;
bool operator<(const Node &W) const
{
if(score != W.score) return score > W.score;
if(cnt != W.cnt) return cnt < W.cnt;
return school < W.school;
}
};
map<string,Node> mp;
int n;
string trans(string s)
{
for(int i=0;i<s.size();i++)
s[i]=tolower(s[i]);
return s;
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
string id,school;
int score;
cin>>id>>score>>school;
school=trans(school);
mp[school].school=school;
if(id[0] == 'A')
mp[school].scorea+=score;
else if(id[0] == 'B')
mp[school].scoreb+=score;
else
mp[school].scoret+=score;
mp[school].cnt++;
}
vector<Node> res;
for(auto t:mp)
{
t.se.score=t.se.scoreb/1.5+t.se.scorea+t.se.scoret*1.5;
res.pb(t.se);
}
sort(res.begin(),res.end());
cout<<res.size()<<endl;
for(int i=0;i<res.size();i++)
{
if(i && res[i].score == res[i-1].score)
res[i].rank=res[i-1].rank;
else
res[i].rank=i+1;
cout<<res[i].rank<<' '<<res[i].school<<' '<<res[i].score<<' '<<res[i].cnt<<endl;
}
//system("pause");
return 0;
}