您的位置:首页 > 其它

csuoj 1339 最后一滴血

2014-10-08 20:16 253 查看
水题。

标记一下某个队做没做出过某道题,然后从前往后扫。

代码:

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

int res[15];
int rest[15];
bool solve[105][15];
struct node{
    int t,d;
    int p;
    bool ok;
}G[1005];

int main(){
    int n,t,m;
    scanf("%d%d%d",&n,&t,&m);
    memset(rest,-1,sizeof(rest));
    for(int i=1;i<=m;i++){
        char tmp1[5];
        char tmp2[5];
        scanf("%d%d%s%s",&G[i].t,&G[i].d,tmp1,tmp2);
        G[i].p=(int)(tmp1[0]-'A');
        if(tmp2[0]=='Y'){
            G[i].ok=1;
        }
        else G[i].ok=0;
    }
    for(int i=1;i<=m;i++){
        if(G[i].ok){
            if(!solve[G[i].d][G[i].p]){
                res[G[i].p]=G[i].d;
                rest[G[i].p]=G[i].t;
                solve[G[i].d][G[i].p]=1;
            }
        }
    }
    for(int i=0;i<n;i++){
        printf("%c",char('A'+i));
        if(rest[i]==-1){
            printf(" - -\n");
        }
        else printf(" %d %d\n",rest[i],res[i]);
    }
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: