#P10567. Grid Number Arrangement Parity
Grid Number Arrangement Parity
Grid Number Arrangement Parity
You are given a square grid of side length \(n\). You need to fill the grid with the numbers from \(1\) to \(n^2\) such that:
- The sum of the numbers in every row is odd.
- The sum of the numbers in every column is even.
Before actually arranging the numbers, you are required to check whether any such arrangement exists. If it exists, output Yes
; otherwise, output No
.
Note: You are not required to provide the actual arrangement, only to determine if one exists.
Hint: Consider the parity of the total sum computed by rows and columns.
inputFormat
The input consists of a single integer \(n\) representing the side length of the grid, where \(1 \le n \le 10^5\).
outputFormat
Output a single line: Yes
if there exists an arrangement satisfying the conditions, or No
otherwise.
sample
2
Yes