#include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int x, y; cin >> x >> y; pair aimPos = 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; bool knightThreeStep = false; queue> q; q.push(knightPos); while (!q.empty()) { knightPos = q.front(); if (knightPos == aimPos) { arrival = true; break; } q.pop(); if (knightThreeStep == false) { for (int i = 0; i < 8; ++i) { q.push(make_pair(knightPos.first + knightMove.at(i).first, knightPos.second + knightMove.at(i).second)); } } if (q.size() == 512) knightThreeStep = true; //8^3 } cout << (arrival ? "YES" : "NO") << endl; return 0; }