Automatic Judge

automatic judg

题意:就是考ACM的计时规则,用的总时间sum

1.已经AC的不管以后再怎么弄,不增加罚时;

2.某一题在AC之前WA一次增加20分钟的罚时,在哪一时刻AC,用的总时间sum+=这一刻+20*次数

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node
{
    int id,h,f;
    string s;
};
node no[110];
bool cmp(node a,node b)
{
    if(a.id!=b.id)
    return a.id<b.id;
    else
    {
        if(a.h!=b.h)
            return a.h<b.h;
        return a.f<b.f;
    }
}
int main()
{
  int t,n,m,i,j,sum1,sum2,st,ed,cnt,ans,flag;
  string ss;
  scanf("%d",&t);
  while(t--)
  {
      scanf("%d%d",&n,&m);
      sum1=sum2=0;
      ans=0;
      for(i=1;i<=m;i++)
      {
          scanf("%d",&no[i].id);
          cin>>ss;
          no[i].h=ss[1]-'0';
          no[i].f=(ss[3]-'0')*10+ss[4]-'0';
          cin>>no[i].s;
      }
      sort(no+1,no+1+m,cmp);
      //for(i=1;i<=m;i++)
        //cout<<no[i].id<<endl;
      for(i=1;i<=m;i++)
      {
          st=i;
          for(j=i+1;j<=m;j++)
          {
              if(no[j].id==no[st].id)
                continue;
              else
              {
                  ed=j-1;
                  break;
              }
          }
          if(j>m)
            ed=m;//cout<<st<<" "<<ed<<endl;
          if(no[st].s=="AC")
          {
                sum1+=no[st].h;
                sum2+=no[st].f;
                ans++;
                i=ed;
          }
          else
          {
              cnt=0;
              flag=0;
              for(j=st;j<=ed;j++)
              {
                  if(no[j].s=="AC")
                    {
                        ans++;
                        flag=1;
                        break;
                    }
                  else
                    cnt++;
              }
              if(flag)
              {
                  sum1+=no[j].h;
                sum2+=no[j].f+cnt*20;
              }
              i=ed;
          }
      }
      int res=sum1*60+sum2;
      printf("%d %d\n",ans,res);
  }
}
//人一我百,人百我万
//时间

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值