#C6799. Accessible Hexagonal Grid
Accessible Hexagonal Grid
Accessible Hexagonal Grid
In this problem, you are given two cells on an infinite hexagonal grid. Each cell is described by its coordinates \( (x_1, y_1) \) and \( (x_2, y_2) \). Two cells are considered accessible from one another if the parity of the sum of coordinates of the two cells is the same, i.e., if
\( (x_1+y_1) \bmod 2 = (x_2+y_2) \bmod 2 \)
If the condition holds, output YES
, otherwise output NO
.
inputFormat
The input consists of a single line containing four space-separated integers: x1
, y1
, x2
, and y2
.
outputFormat
Output a single line containing YES
if the two cells are accessible from one another, or NO
otherwise.
0 0 2 2
YES