#C3530. Dog Placement Challenge
Dog Placement Challenge
Dog Placement Challenge
Chef has a rectangular park of size \(M \times N\) and wants to place his dog at a specific cell \((X, Y)\). However, the dog must not be placed on any edge of the park. Your task is to determine if the dog can be placed at the given cell without being on the border.
The park grid has rows numbered from 1 to M and columns from 1 to N. A cell \((X, Y)\) is considered safe if and only if \(1 < X < M\) and \(1 < Y < N\). If the cell is safe, output YES
; otherwise, output NO
.
Input: The first line contains an integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains four integers \(M\), \(N\), \(X\), \(Y\) separated by spaces.
Output: For each test case, output a single line with either YES
if the dog can be placed safely, or NO
if not.
inputFormat
The input begins with a single integer \(T\) which represents the number of test cases. For each test case, there is a single line containing four space-separated integers: \(M\), \(N\), \(X\), and \(Y\).
\(M\) and \(N\) define the dimensions of the park, while \(X\) and \(Y\) denote the row and column where Chef intends to place the dog.
outputFormat
For each test case, print YES
if the dog can be placed in a cell that is not on the edge of the park (i.e. \(1 < X < M\) and \(1 < Y < N\)); otherwise, print NO
. Each result should be on a new line corresponding to each test case.
4
5 5 2 3
6 7 1 4
4 4 3 2
7 8 7 1
YES
NO
YES
NO
</p>