骗个stdQWQ

作者亲自编的逆天题目QWQ
(团队是作者的QAQ)
作者非常的lj,所以来论坛球神犇恩赐一个std
会给解决方案的QWQ
这是作者写的连样例都过不去的代码awa:

#include<bits/stdc++.h>
using namespace std;
struct dr{
	int x,y,dc,res;
};
int n,m,sx,sy,kx,ky;
char c;
int a[55][55];
bool vis[55][55][4];
int drc;
int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
void is_drc(){
	if(c=='N') drc=0;
	if(c=='E') drc=1;
	if(c=='S') drc=2;
	if(c=='W') drc=3;
}
bool can(int x,int y,int dc){
	int p=0;
	if(x<1 || x>n+1 || y<1 || y>m+1 || vis[x][y][dc] ||(x==1 && dc==0) || (y==1 && dc==3) || (x==n+1 && dc==2) || (y==m+1 && dc==1)) return false;
	if(dc==0){
		p+=a[x][y-1]+a[x][y]+a[x][y+1]+a[x-1][y-1]+a[x-1][y]+a[x-1][y+1];
		if(p==6) return false;
		else if(p==5){
			if(a[x][y-1]+a[x][y]+a[x][y+1]==3) return false;
			return true;
		}else return true;
	}
	if(dc==1){
		p+=a[x-1][y]+a[x][y]+a[x+1][y]+a[x-1][y+1]+a[x][y+1]+a[x+1][y+1];
		if(p==6) return false;
		else if(p==5){
			if(a[x-1][y]+a[x][y]+a[x+1][y]==3) return false;
			return true;
		}else return true;
	}
	if(dc==2){
	    p+=a[x][y-1]+a[x][y]+a[x][y+1]+a[x+1][y-1]+a[x+1][y]+a[x+1][y+1];
	    if(p==6) return false;
	    else if(p==5){
	        if(a[x][y-1]+a[x][y]+a[x][y+1]==3) return false;
	        return true;
	    }else return true;
	}
	if(dc==3){
	    p+=a[x-1][y-1]+a[x][y-1]+a[x+1][y-1]+a[x-1][y]+a[x][y]+a[x+1][y];
	    if(p==6) return false;
	    else if(p==5){
	        if(a[x-1][y]+a[x][y]+a[x+1][y]==3) return false;
	        return true;
	    }else return true;
	}
}
void bfs(){
	queue<dr> q;
	q.push({sx,sy,drc,0});
	while(!q.empty()){
		auto [x,y,dc,res]=q.front();
		q.pop();
		if(x==kx && y==ky){
			cout<<res;
			return;
		}
		for(int i=0;i<4;i++){
			if(!vis[x][y][i]){
				q.push({x,y,i,res+min(abs(dc-i),abs(dc+4-i))});
				vis[x][y][i]=1;
			}
		}
		if(can(x,y,dc)){
			x+=dx[dc];
			y+=dy[dc];
			q.push({x,y,dc,res+1});
			if(can(x,y,dc)){
				x+=dx[dc];
				y+=dy[dc];
				q.push({x,y,dc,res+1});
				vis[x][y][dc]=1;
			}
			vis[x-dx[dc]][y-dy[dc]][dc]=1;
		}
	}
	cout<<-1;
}
int main(){
	//freopen("1.in","r",stdin);造数据用的,别管
	//freopen("1.out","w",stdout);
	cin>>n>>m>>sx>>sy>>kx>>ky>>c;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			int x;
			cin>>x;
			if(x){
				a[i][j]=1;
				a[i+1][j]=1;
				a[i][j+1]=1;
				a[i+1][j+1]=1;
			}
		}
	}
	is_drc();
	bfs();
    return 0;
}