// chess.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include #include using namespace std; bool board[1000][1000]; int main() { ifstream fin; fin.open("chess.in"); int N, K, X1, Y1, X2, Y2; fin >> N >> K >> X1 >> Y1 >> X2 >> Y2; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { int b; fin >> b; board[i][j] = b != 0; } } fin.close(); ofstream fout; fout.open("chess.out"); int dx = X2 - X1, dy = Y2 - Y1; int adx = abs(dx), ady = abs(dy); int adx_ady = adx + ady; bool yes = true; if ((K & 1) != (adx_ady & 1)) yes = false; if (K * 3 < adx_ady) yes = false; fout << (yes ? "YES" : "NO") << endl; fout.close(); return 0; }