UVA 1589 xiangqi AC不了 udebug可以过 找不到原因 求大神看看代码哪里有问题

#include
int main()
{
while(1)
{
int a,b,c,e,f,m,n,g[15],h[15],i=0,map[15][15],maps[15][15];
char d[15];
scanf("%d%d%d",&a,&b,&c);
if(a==0&&b==0&&c==0)
break;
for(i=0;i<a;i++)
{
getchar();
scanf("%c%d%d",&d[i],&g[i],&h[i]);

}
for(e=0;e<15;e++)
for(f=0;f<15;f++)
{

            map[e][f]=1;
            maps[e][f]=1;
        }
    for(e=0;e<15;e++)
        map[0][e]=0;
    for(e=0;e<=4;e++)
        map[e][3]=0;
    for(e=0;e<=7;e++)
        map[4][e]=0;
    for(e=0;e<=4;e++)
        map[e][7]=0;
    maps[b][c]=2;
    for(e=0;e<a;e++)
        maps[g[e]][h[e]]=0;
    for(e=0;e<a;e++)
    {
        if(d[e]=='G')
        {
            m=g[e];
            n=h[e];
        while(maps[--m][n]&&m>=0)
            map[m][n]=0;
        map[m][n]=0;
        }
        if(d[e]=='R')
        {

            m=g[e];
            n=h[e];
            while(maps[m][++n]&&n<=13)
                map[m][n]=0;
            map[m][n]=0;
            m=g[e];
            n=h[e];
            while(maps[m][--n]&&n>=1)
                map[m][n]=0;
            map[m][n]=0;
            m=g[e];
            n=h[e];
            while(maps[++m][n]&&m<=13)
                map[m][n]=0;
            map[m][n]=0;
            m=g[e];
            n=h[e];
            while(maps[--m][n]&&m>=1)
                map[m][n]=0;
            map[m][n]=0;


        } 

        if(d[e]=='C')
        {

            m=g[e];
            n=h[e];
            while(maps[++m][n]&&m<=12);
            while(maps[++m][n]&&m<=12)
                map[m][n]=0;
            map[m][n]=0;

            m=g[e];
            n=h[e];
            while(maps[--m][n]&&m>=1);
            while(maps[--m][n]&&m>=1)
                map[m][n]=0;

            m=g[e];
            n=h[e];

            while(maps[m][++n]&&n<=12);

            while(maps[m][++n]&&n<=12)
                map[m][n]=0;
            map[m][n]=0;

            m=g[e];
            n=h[e];
            while(maps[m][--n]&&n>=1);
            while(maps[m][--n]&&n>=1)
                map[m][n]=0;
            map[m][n]=0;

        }
        if(d[e]=='H')
        {
            m=g[e];
            n=h[e];

            if(maps[m][n+1]&&maps[m][n+1]!=2)
            {
                map[m+1][n+2]=0;
                map[m-1][n+2]=0;
            }
            if(maps[m][n-1]&&maps[m][n-1]!=2)
            {
                map[m+1][n-2]=0;
                map[m-1][n-2]=0;
            }
            if(maps[m+1][n]&&maps[m+1][n]!=2)
            {
                map[m+2][n-1]=0;
                map[m+2][n+1]=0;
            }
            if(maps[m-1][n]&&maps[m-1][n]!=2)
            {
                map[m-2][n+1]=0;
                map[m-2][n-1]=0;
            }
        }


    }

if(map[b][c+1]==0&&map[b][c-1]==0&&map[b+1][c]==0&&map[b-1][c]==0)
    printf("YES\n");
else
    printf("NO\n");


}
return 0;

}

A-aqweqwsZAaAAA.zcxeAWAA