#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include//assert(); #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)< ///////// #ifdef getchar_unlocked #define mygc(c) (c)=getchar_unlocked() #else #define mygc(c) (c)=getchar() #endif #ifdef putchar_unlocked #define mypc(c) putchar_unlocked(c) #else #define mypc(c) putchar(c) #endif ///////// typedef long long LL; typedef long double LD; typedef unsigned long long ULL; ///////// using namespace::std; ///////// #ifdef _DEBUG #define DEBUG_BOOL(b) assert(b) #else #define DEBUG_BOOL(b) #endif /////数値読み込み #define ENABLE_READER_ON(T) \ inline void reader(T &x){int k;x = 0;bool flag = true;\ while(true){mygc(k);\ if( k == '-'){flag = false;break;}if('0' <= k && k <= '9'){x = k - '0';break;}\ }\ if( flag ){while(true){mygc(k);if( k<'0' || '9' inline T gcd(T a, T b){return b == 0 ? a : gcd(b, a % b);} // 最小公倍数 template inline T lcm(T a, T b){return a * b / gcd(a, b);} //////////////////////////////// struct POS{ int X; int Y; }; inline void solve(){ int H,W; reader(H); reader(W); vector< vector > Bor(H,vector(W,0)); int sx,sy,gx,gy; reader(sx);reader(sy);reader(gx);reader(gy); --sx;--sy;--gx;--gy; string str; for(int i=0;i > ikeru(H,vector(W,false)); queue qu; POS pos,next; pos.X = sx; pos.Y = sy; ikeru[sx][sy] = true; qu.push(pos); int dx[8]={1,2,0,0,-1,-2,0,0}; int dy[8]={0,0,1,2,0,0,-1,-2}; while( !qu.empty() ){ pos = qu.front(); qu.pop(); for(int i=0;i<8;++i){ //4方向*2 next.X = pos.X+dx[i]; next.Y = pos.Y+dy[i]; //範囲チェック if( 0 <= next.X && next.X < H && 0 <= next.Y && next.Y < W){ //済みチェック if( ikeru[next.X][next.Y] == false ){ if( i%2==0 && abs(Bor[pos.X][pos.Y] - Bor[next.X][next.Y]) <= 1 ){ //隣接 ikeru[next.X][next.Y] = true; qu.push(next); }else if(i%2==1 && Bor[pos.X][pos.Y] == Bor[next.X][next.Y] && Bor[pos.X][pos.Y] > Bor[(pos.X+next.X)/2][(pos.Y+next.Y)/2] ){ //一ます空き //間が高いとダメ ikeru[next.X][next.Y] = true; qu.push(next); } } } } } if( ikeru[gx][gy] ){ writer("YES"); }else{ writer("NO"); } /*cout << endl; for(int i=0;i