#include #include #include using namespace std; int main() { int x, y; cin >> x >> y; pair Destination = make_pair(x, y); pair knightPos(0, 0); vector> knightMove { make_pair(-2,-1), make_pair(-2,1), make_pair(-1, 2), make_pair(1,2), make_pair(2,1), make_pair(2,-1), make_pair(1,-2), make_pair(-1,-2) }; bool arrival = false; int KnightStep = 0; queue> q; q.push(knightPos); while (!q.empty()) { knightPos = q.front(); if (knightPos == Destination) { arrival = true; break; } q.pop(); if (KnightStep <= 3) { for (int i = 0; i < 8; ++i) { q.push(make_pair(knightPos.first + knightMove.at(i).first, knightPos.second + knightMove.at(i).second)); } } KnightStep++; } cout << (arrival ? "YES" : "NO") << endl; return 0; }