有大佬知道这个为什么会RE麽
#include<bits/stdc++.h>
#define int long long
const int lop=205*205*(1<<8)+1;
using namespace std;
int cnt,n,m,sx,sy,tx,ty;
int dx[]={-1,0,1,0},dy[]={0,1,0,-1};
struct Node{
int x,y,sta;
}pre[205][205][(1<<8)+5],q[lop];
char mp[205][205],ans[lop];
bool vis[205][205][(1<<8)+5];
void print(int x,int y,int s){
int mx,my,ms;
while(x!=sx || y!=sy || s){
Node tmp=pre[x][y][s];
mx=tmp.x,my=tmp.y,ms=tmp.sta;
x=mx,y=my,s=ms;
if(mp[x][y]>='a' && mp[x][y]<='h') cnt++;
}
}
void bfs(){
int hd=lop-1,tl=lop-1,pos,nx,ny,ns;
q[hd]=(Node){sx,sy,0};
vis[sx][sy][0]=1;
while(hd<=tl){
pos=(hd++)%lop;
nx=q[pos].x;
ny=q[pos].y;
ns=q[pos].sta;
if(nx==tx && ny==ty){
print(nx,ny,ns);
return;
}
for(int i=0;i<4;++i){
int ms,mx=nx+dx[i],my=ny+dy[i];
if(!mx || !my || mx>n || my>m || mp[mx][my]=='X') continue;
if(mp[mx][my]>='a' && mp[mx][my]<='z'){
int num=mp[mx][my]-'a',tmp=(ns>>num)&1;
ms=ns^((tmp^1)<<num);
if(vis[mx][my][ms]) continue;
vis[mx][my][ms]=true;
pre[mx][my][ms]=(Node){nx,ny,ns};
if(tmp)pos=(--hd)%lop;
else pos=(++tl)%lop;
q[pos]=(Node){mx,my,ms};
}
else if(mp[mx][my]>='A' && mp[mx][my]<='Z'){
int num=mp[mx][my]-'A',tmp=(ns>>num)&1;
if(!tmp)continue;
ms=ns;
if(vis[mx][my][ms]) continue;
vis[mx][my][ms]=true;
pre[mx][my][ms]=(Node){nx,ny,ns};
pos=(--hd)%lop;
q[pos]=(Node){mx,my,ms};
}
else{
ms=ns;
if(vis[mx][my][ms]) continue;
vis[mx][my][ms]=true;
pre[mx][my][ms]=(Node){nx,ny,ns};
pos=(--hd)%lop;
q[pos]=(Node){mx,my,ms};
}
}
}
}
signed main(){
cin>>n>>m;
for(int i=1;i<=n;++i){
string s;
cin>>s;
for(int j=1;j<=m;++j){
if(s[j-1]=='S') sx=i,sy=j,mp[i][j]='.';
else if(s[j-1]=='T') tx=i,ty=j,mp[i][j]='.';
else mp[i][j]=s[j-1];
}
}
bfs();
cout<<cnt;
return 0;
}