hdu 6023 Automatic Judge

上面都是废话

For each submission, if it is the first time that the judge returns ``AC'' on this problem, then it means you have passed this problem, and the current time will be added to the penalty of your team. In addition, every time you pass a problem, each unsuccessful try for that problem before is counted as 20 minutes penalty, it should also be added to the penalty of your team.
Now given the number of problems in the contest and the submission records of a team. Please write a program to calculate the number of problems the team passed and their penalty.

Input

The first line of the input contains an integer T(1≤T≤20), denoting the number of test cases.
In each test case, there are two integers n(1≤n≤13) and m(1≤m≤100) in the first line, denoting the number of problems and the number of submissions of a team. Problems are labeled by 1001, 1002, ..., 1000+n.
In the following m lines, each line contains an integer x(1001≤x≤1000+n) and two strings t(00:00≤t≤05:00) and s, denoting the team submits problem xat time t, and the result is s. t is in the format of HH:MM, while s is in the set \{AC, PE, WA, RE, TLE, MLE, OLE\}. The team is so cautious that they never submit a CE code. It is guaranteed that all the t in the input is in ascending order and every t is unique.

Output

For each test case, print a single line containing two integers A and B, denoting the number of problems the team passed and the penalty.

题意:按照ACM规则计算过题数和罚时,注意第一次AC了某道题后,这道题再交就没任何影响了

一开始拿mp[x]=-1表示已经AC,但是没有卡主else循环,导致wa了两发。想起LRJ说过拿数去做标记有时候就是会出现这种易错的情况,反正也不缺那点空间,以后还是开数组标记叭

#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int T;
map<int,int> mp;
int penalty(string t)
{
    int i=0;
    int h=0,m=0;
    h=(t[0]-'0')*10+(t[1]-'0');
    m=(t[3]-'0')*10+(t[4]-'0');
    return h*60+m;
}

int main()
{
    cin>>T;
    while(T--)
    {
        int n,m;
        cin>>n>>m;
        mp.clear();
        int ans=0;
        int cnt=0;
        for(int i=1;i<=m;++i)
        {
            int x;
            string t,s;
            cin>>x>>t>>s;
            if(s[0]=='A'&&mp[x]!=-1)        //保证A了的题只算一次
            {
                cnt++;
                ans+=penalty(t);
                ans+=mp[x]*20;
                mp[x]=-1;
            }
            else                            //最好用vis,这里一开始没发现wa了两发
            {
                if(mp[x]==-1) continue;
                mp[x]++;
            }
        }
        cout<<cnt<<' '<<ans<<endl;
    }
    return 0;

}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值