Codeforces Round #281 (Div. 2) - A

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 100;
struct node{
int y,r;
node():y(0),r(0){}
};
node cnt[2][maxn];
int vis[2][maxn];
char str[2][maxn];
int main()
{
    gets(str[0]);
    gets(str[1]);
    int n;
    cin>>n;
    char ff,pai;
    int id,t;
    for(int i=1;i<=n;i++){
        cin>>t>>ff>>id>>pai;
        int team = ff=='h' ? 0 : 1;
        pai =='y' ? cnt[team][id].y++:cnt[team][id].r++;
        if(cnt[team][id].y==2){ //最重要的判断条件搞错了
              cnt[team][id].y=0;
              cnt[team][id].r++;
        }
        if(cnt[team][id].r==1 && !vis[team][id]){
                vis[team][id]=1;
              cout<<str[team]<<" "<<id<<" "<<t<<endl;
        }
    }
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值