#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #ifdef _MSC_VER #include "bits\stdc++.h" #else #include #endif #include #include #include #include #include #define REP(i,a,b) for(i=a;i> x >> y; queue q; Zahyou start = {0,0,0}; q.push(start); while (q.size()) { Zahyou now = q.front(); q.pop(); if(x == now.x && y == now.y) { YES = true; break; } if(now.cnt < 3) { for(i=0;i<8;i++) { Zahyou next = now; next.x += dx[i]; next.y += dy[i]; next.cnt++; q.push(next); } } } if(YES) puts("YES"); else puts("NO"); return 0; }