https://ac.nowcoder.com/acm/contest/327/B

C++版本一

题解:模拟

#include <bits/stdc++.h>
using namespace std;
map<string,int> mp;
int vis[505];
int a[505][10];
int b[505][10];
int r[10]={500,1000,1500,2000,2500};
int score[505];
int n,m;
 
int main()
{
    cin>>n>>m;
    for (int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        mp[s]=i;
    }
    for (int i=1;i<=m;i++)
    {
        int t;
        string name,id,result;
        cin>>t>>name>>id>>result;
        int x=mp[name];
        vis[x]=1;
        if (result=="CE")
        {
            b[x][id[0]-'A']=0;
        }
        else if (result=="AC")
        {
            b[x][id[0]-'A']=max(r[id[0]-'A']/10*3,r[id[0]-'A']-t*(r[id[0]-'A']/250)-50*a[x][id[0]-'A']);
            a[x][id[0]-'A']++;
        }
        else
        {
            b[x][id[0]-'A']=0;
            a[x][id[0]-'A']++;
        }
    }
    for (int i=1;i<=n;i++)
    {
        score[i]=0;
        for (int j=0;j<5;j++)
        {
            score[i]+=b[i][j];
        }
    }
    int x=1,y=0;
    for (int i=1;i<=n;i++)
    {
        if (vis[i]==1) y++;
    }
    for (int i=1;i<=n;i++)
    {
        if (score[i]>score[mp["cnz"]]) x++;
    }
    if (vis[mp["cnz"]]==1)
    {
        printf("%d\n",score[mp["cnz"]]);
        printf("%d/%d\n",x,y);
    }
    else printf("-1\n");
    return 0;
}