#include #include using namespace std; typedef long long LL; int X,Y; LL dist(int x1,int y1,int x2,int y2){ return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); } bool canGoTo(int x,int y,int &num) { if (x==X && y==Y){ cout<<"YES"<> myVec; myVec.push_back(make_pair(x-2,y-1)); myVec.push_back(make_pair(x-2,y)); myVec.push_back(make_pair(x-2,y+1)); myVec.push_back(make_pair(x-1,y-2)); myVec.push_back(make_pair(x-1,y-1)); myVec.push_back(make_pair(x-1,y)); myVec.push_back(make_pair(x-1,y+1)); myVec.push_back(make_pair(x-1,y+2)); myVec.push_back(make_pair(x,y-2)); myVec.push_back(make_pair(x,y-1)); myVec.push_back(make_pair(x,y)); myVec.push_back(make_pair(x,y+1)); myVec.push_back(make_pair(x,y+2)); myVec.push_back(make_pair(x+1,y-2)); myVec.push_back(make_pair(x+1,y-1)); myVec.push_back(make_pair(x+1,y)); myVec.push_back(make_pair(x+1,y+1)); myVec.push_back(make_pair(x+1,y+2)); myVec.push_back(make_pair(x+2,y-1)); myVec.push_back(make_pair(x+2,y)); myVec.push_back(make_pair(x+2,y+1)); int i; for (i=0;idistXY){ distMin=distXY; xMin=myVec[i].first; yMin=myVec[i].second; } } myVec.clear(); return canGoTo(xMin,yMin,num); } int main(int argc, char* argv[]) { cin>>X>>Y; int num=0; canGoTo(0,0,num); return 0; }