中国象棋啊!!哥以前玩的是国际象棋啊!!!!中国象棋伤不起啊!!尼玛将能灰过去把别人干掉。。。。马tm还会被拌腿。。尼玛搞的这么复杂有意思啊。。。最坑爹的是将尼玛还不能走斜线,不能走尼玛在题目的棋盘上画毛斜线啊!!!!画毛啊!!!!!搞的劳资wa一下午。。。伤不起啊。。。把将的路线改成上下左右。。。终于ac了。。。不过我还是很佩服现场赛ac这道题的小盆友
#include<iostream>
using namespace std;
int n,qx,qy,tx,ty,temp;
char c;
int b[11][11];
char a[11][11];
char s[11][11];
const int way[8][2]={{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{-1,2},{-1,-2},{1,-2}};
const int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
const int qw[8][2]={{1,1},{1,-1},{-1,1},{-1,-1},{1,0},{0,1},{-1,0},{0,-1}};
inline void init()
{
memset(b,false,sizeof(b));
memset(a,0,sizeof(a));
return ;
}
inline bool can(int ix,int iy)
{
if(1<=ix && ix<=10 && iy>=1 && iy<=9)
{
return true;
}
return false;
}
inline bool yes(int x,int y)
{
if(x<=3 && x>=1 && y<=6 && y>=4 )
{
return true;
}
return false;
}
void pao(int x,int y)
{
for(int i=0;i<4;i++)
{
temp=0;
for(int j=1;j<=10;j++)
{
int nowx=x+dir[i][0]*j;
int nowy=y+dir[i][1]*j;
if(!can(nowx,nowy))
{
break;
}
if(s[nowx][nowy]!=0)
{
temp++;
continue;
}
if(temp==1)
{
b[nowx][nowy]=true;
}
}
}
return ;
}
void che(int x,int y)
{
for(int i=0;i<4;i++)
{
for(int j=1;j<=10;j++)
{
int nowx=x+dir[i][0]*j;
int nowy=y+dir[i][1]*j;
if(!can(nowx,nowy) || s[nowx][nowy]!=0)
{
break;
}
b[nowx][nowy]=true;
}
}
return ;
}
void GG(int x,int y)
{
for(int i=1;i<=10;i++)
{
int nowx=x-i;
if(!can(nowx,y) || s[nowx][y]!=0)
{
return ;
}
b[nowx][y]=true;
}
return ;
}
void start()
{
for(int i=1;i<=10;i++)
{
for(int j=1;j<=9;j++)
{
if(0 == s[i][j])
{
continue;
}
else if(s[i][j]=='H')
{
for(int k=0;k<8;k++)
{
int nowx=i+way[k][0];
int nowy=j+way[k][1];
int px= i + dir[k/2][0];
int py= j + dir[k/2][1];
if(s[px][py]!=0)
{
continue;
}
if(can(nowx,nowy))
{
b[nowx][nowy]=true;
}
}
}
else if(s[i][j]=='C')
{
pao(i,j);
}
else if(s[i][j]=='R')
{
che(i,j);
}
else if(s[i][j]=='G')
{
GG(i,j);
}
}
}
}
void give()
{
for(int i=1;i<=10;i++)
{
for(int j=1;j<=10;j++)
{
s[i][j]=a[i][j];
}
}
return ;
}
bool notdead()
{
for(int i=1;i<=10;i++)
{
int nowx=qx+i;
int nowy=qy;
if(!can(nowx,nowy))
{
break;
}
if(a[nowx][nowy]=='G')
{
return true;
}
if(a[nowx][nowy]!=0)
{
break;
}
}
for(int i=0;i<4;i++)
{
int nowx=qx+dir[i][0];
int nowy=qy+dir[i][1];
if(!yes(nowx,nowy))
{
continue;
}
give();
s[nowx][nowy]=0;
memset(b,0,sizeof(b));
start();
/* cout<<nowx<<" "<<nowy<<endl;
for(int ix=1;ix<=10;ix++)
{
for(int jx=1;jx<=9;jx++)
{
cout<<b[ix][jx]<<" ";
}
cout<<endl;
}
cout<<endl; */
if(b[nowx][nowy]==false)
{
return true;
}
}
return false;
}
int main()
{
while(cin>>n>>qx>>qy)
{
init();
if(0==n && 0==qx && 0==qy)
{
break;
}
for(int i=1;i<=n;i++)
{
cin>>c>>tx>>ty;
a[tx][ty]=c;
}
if(notdead())
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
return 0;
}