#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int x[10],y[10];
int dangerous[17][17];
char z[10];
int vis[17][17];
char s[100][100];
int main(){
    int n;
    while(~scanf("%d",&n)){
        memset(x,0,sizeof(x));
        memset(y,0,sizeof(y));
        memset(z,0,sizeof(z));
        memset(vis,0,sizeof(vis));
        memset(s,0,sizeof(s));
        memset(dangerous,0,sizeof(dangerous));
        int a,b;
        scanf("%d%d",&a,&b);
        if(n==0)
            break;
        for(int i=1;i<=n;i++){
            cin>>z[i]>>x[i]>>y[i];//getchar();scanf("%c%d%d",&z[i],&x[i],&y[i]);这种输入过不了
            vis[x[i]][y[i]]=1;
        }
        int flag=0;
        for(int i=1;i<=n;i++){
            flag=0;
            if(z[i]=='G'){
                for(int j=x[i]-1;j>=1;j--){
                    if(!vis[j][y[i]])
                        dangerous[j][y[i]]=1;
                    else{
                        dangerous[j][y[i]]=1;
                        break;
                    }
                }
                if(b==y[i]){
                    flag=0;
                    for(int ii=a+1;ii<x[i];ii++){
                        if(vis[ii][b]==1)
                            flag=1;
                    }
                    if(!flag){
                        printf("NO\n");
                        flag=10;
                        break;
                    }
                }
            }
            else if(z[i]=='R'){
                int ii=0;
                for(ii=x[i]-1;ii>=1;ii--){
                    if(!vis[ii][y[i]])
                        dangerous[ii][y[i]]=1;
                    else{
                        dangerous[ii][y[i]]=1;
                        break;
                    }
                }
                //dangerous[ii][y[i]]=1;
                for(ii=x[i]+1;ii<=10;ii++){
                    if(!vis[ii][y[i]])
                        dangerous[ii][y[i]]=1;
                    else{
                        dangerous[ii][y[i]]=1;
                        break;
                    }
                }
                //dangerous[ii][y[i]]=1;
                for(ii=y[i]-1;ii>=1;ii--){
                    if(vis[x[i]][ii]==0)
                        dangerous[x[i]][ii]=1;
                    else{
                        dangerous[x[i]][ii]=1;
                        break;
                    }
                }
                //dangerous[x[i]][ii]=1;
                for(ii=y[i]+1;ii<=9;ii++){
                    if(vis[x[i]][ii]==0)
                        dangerous[x[i]][ii]=1;
                    else{
                        dangerous[x[i]][ii]=1;
                        break;
                    }
                }
                //dangerous[x[i]][ii]=1;
            }
            else if(z[i]=='C'){
                flag=0;
                for(int ii=x[i]-1;ii>=2;ii--){
                    if(vis[ii][y[i]]==1){
                        flag=ii;
                        break;
                    }
                }
                if(flag){
                    for(int ii=flag-1;ii>=1;ii--){
                        if(vis[ii][y[i]]==0)
                            dangerous[ii][y[i]]=1;
                        else{
                            dangerous[ii][y[i]]=1;
                            break;
                        }
                    }
                }
                flag=0;
                for(int ii=x[i]+1;ii<=9;ii++){
                    if(vis[ii][y[i]]==1){
                        flag=ii;
                        break;
                    }
                }
                if(flag){
                    for(int ii=flag+1;ii<=10;ii++){
                        if(vis[ii][y[i]]==0)
                            dangerous[ii][y[i]]=1;
                        else{
                            dangerous[ii][y[i]]=1;
                            break;
                        }
                    }
                }
                flag=0;
                for(int ii=y[i]-1;ii>=2;ii--){
                    if(vis[x[i]][ii]==1){
                        flag=ii;
                        break;
                    }
                }
                if(flag){
                    for(int ii=flag-1;ii>=1;ii--){
                        if(vis[x[i]][ii]==0)
                            dangerous[x[i]][ii]=1;
                        else{
                            dangerous[x[i]][ii]=1;
                            break;
                        }
                    }
                }
                flag=0;
                for(int ii=y[i]+1;ii<=8;ii++){
                    if(vis[x[i]][ii]==1){
                        flag=ii;
                        break;
                    }
                }
                if(flag){
                    for(int ii=flag+1;ii<=9;ii++){
                        if(vis[x[i]][ii]==0)
                            dangerous[x[i]][ii]=1;
                        else{
                            dangerous[x[i]][ii]=1;
                            break;
                        }
                    }
                }
            }
            else if(z[i]=='H'){
                if(vis[x[i]-1][y[i]]==0){
                    //if(!vis[x[i]-2][y[i]-1])
                        dangerous[x[i]-2][y[i]-1]=1;
                    //if(!vis[x[i]-2][y[i]+1])
                        dangerous[x[i]-2][y[i]+1]=1;
                }
                if(vis[x[i]+1][y[i]]==0){
                    //if(!vis[x[i]+2][y[i]-1])
                        dangerous[x[i]+2][y[i]-1]=1;
                    //if(!vis[x[i]+2][y[i]+1])
                        dangerous[x[i]+2][y[i]+1]=1;
                }
                if(vis[x[i]][y[i]-1]==0){
                    //if(!vis[x[i]-1][y[i]-2])
                        dangerous[x[i]-1][y[i]-2]=1;
                    //if(!vis[x[i]+1][y[i]-2])
                        dangerous[x[i]+1][y[i]-2]=1;
                }
                if(vis[x[i]][y[i]+1]==0){
                    //if(!vis[x[i]-1][y[i]+2])
                        dangerous[x[i]-1][y[i]+2]=1;
                    //if(!vis[x[i]+1][y[i]+2])
                        dangerous[x[i]+1][y[i]+2]=1;
                }
            }
        }
        if(flag==10)
            continue;
        flag=0;
        if(a-1>=1)
            if(!dangerous[a-1][b])
                flag=1;
        if(a+1<=3)
            if(!dangerous[a+1][b])
                flag=1;
        if(b-1>=4)
            if(!dangerous[a][b-1])
                flag=1;
        if(b+1<=6)
            if(!dangerous[a][b+1])
                flag=1;
        if(flag)
            printf("NO\n");
        else
            printf("YES\n");
    }
    return 0;
}

Xuzhou Winter Camp 1C(模拟)的更多相关文章

  1. 2019 wannafly winter camp day 3

    2019 wannafly winter camp day 3 J 操作S等价于将S串取反,然后依次遍历取反后的串,每次加入新字符a,当前的串是T,那么这次操作之后的串就是TaT.这是第一次转化. 涉 ...

  2. 2019 wannafly winter camp

    2019 wannafly winter camp Name Rank Solved A B C D E F G H I J K day1 9 5/11 O O O O O day2 5 3/11 O ...

  3. 线段树优化建图(cf787d, 2019Wannafly Winter Camp Day7 Div1 E)

    线段树优化建图,用于区间到区间建边时降低空间复杂度 建立两颗线段树,一颗in, 代表进入这个区间,一颗out,代表从这个区间出去 in树从父亲向儿子建边,代表宏观进入整个区间,不向下寻找 out树从儿 ...

  4. 2020 CCPC-Wannafly Winter Camp Day2

    2020 CCPC-Wannafly Winter Camp Day2 A 托米的字符串 虽然每个子串出现的概率是相同的,但是同一长度的子串个数是不同的,所以要分别处理.计算出某一长度的情况下,元音字 ...

  5. 2020 CCPC Wannafly Winter Camp Day1 C. 染色图

    2020 CCPC Wannafly Winter Camp Day1 C. 染色图 定义一张无向图 G=⟨V,E⟩ 是 k 可染色的当且仅当存在函数 f:V↦{1,2,⋯,k} 满足对于 G 中的任 ...

  6. CCPC-Wannafly Winter Camp Day5 (Div2, onsite) Sorting(线段树)

    题目链接 题意 对序列进行三种操作: 1.区间求和. 2.将区间小于等于$x$的数不改变相对顺序的前提下放到$x$左边,用同样规则将比$x$大的放到右边. 3.将区间大于$x$的数不改变相对顺序的前提 ...

  7. 秦皇岛winter camp 总结

    冬令营在秦皇岛自闭了七天,很多题目看了都没有思路,或者是不知道怎么敲代码.我发现图论的题,自己连怎么建树都给忘了,想了半天.还有很多自己从未接触过的算法.在说说课堂上课的情况,大部分时间都是全程懵逼的 ...

  8. CCPC-Wannafly Winter Camp Day8 (Div2, onsite)

    咕咕咕.    camp补题. 传送门:https://www.zhixincode.com/contest/29/problems A.Aqours 题意:有一棵有根树,根节点为1,给出每个结点的父 ...

  9. CCPC-Wannafly Winter Camp Day7 D---二次函数【数论】【构造】

    题意: 有三个二次函数,分别是$x^2 + a_1x + b_1$, $x^2 + a_2x + b_2$, $x^2 + a_3x + b_3$ 现在要找三个整数$x_1, x_2, x_3$, 使 ...

随机推荐

  1. Cocos2dx版本与CocosBuilder版本匹配问题

    我用的是CocosBuilder 2.1版本,将ccbi导入到xcode 5中时提示: WARNING! Incompatible ccbi file version 警告;ccbi版本不兼容. 查看 ...

  2. MySQL查询in操作 查询结果按in集合顺序显示

    偶尔看到的...或许有人会注意过,但我以前真不知道 SQL: select * from table where id IN (3,6,9,1,2,5,8,7); 这样的情况取出来后,其实,id还是按 ...

  3. java:Map借口及其子类HashMap五,identityHashMap子类

    java:Map借口及其子类HashMap五,identityHashMap子类 了解:identityHashMap子类 一般情况下,标准的Map,是不会有重复的key值得value的,相同的key ...

  4. CheckStyle:unable to parse configuration stream - Element type "message" must be declared

    版本在1.3以上,包括1.3: <!DOCTYPE module PUBLIC          "-//Puppy Crawl//DTD Check Configuration 1. ...

  5. 列存储压缩技巧,除公共除数或者同时减去最小数,字符串压缩的话,直接去重后用数字ID压缩

    Column-store compression At a high level, doc values are essentially a serialized column-store. As w ...

  6. 利用simhash计算文本相似度

    摘自:http://www.programcreek.com/java-api-examples/index.php?source_dir=textmining-master/src/com/gta/ ...

  7. 一篇 jQuery 常用方法及函数的文章留存备忘。

    jQuery 常见操作实现方式 $("标签名") //取html元素 document.getElementsByTagName("") $("#ID ...

  8. LOJ2305 「NOI2017」游戏

    「NOI2017」游戏 题目背景 狂野飙车是小 L 最喜欢的游戏.与其他业余玩家不同的是,小 L 在玩游戏之余,还精于研究游戏的设计,因此他有着与众不同的游戏策略. 题目描述 小 L 计划进行$n$场 ...

  9. ACM学习历程—HDU4746 Mophues(莫比乌斯)

    Description As we know, any positive integer C ( C >= 2 ) can be written as the multiply of some ...

  10. Javascript:必须知道的Javascript知识点之“单线程事件驱动”

    heiboard: Javascript:必须知道的Javascript知识点之“单线程事件驱动”