Do they have the same color?
Given a standard chessboard, we would like to know if two coordinates have the same color.
The input first lists the first coordinates -
r1
(row) and c1
(column), and then lists the second coordinates - r2
(row) and c2
(column). Print Yes
if they have the same color, and No
otherwise.Hint question
Can you think of a smart way of detecting the color of the current position? Do you notice a pattern when rows and columns change?
Input | Output |
1
2
5
2 | Yes |
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F21a5308a-4e3e-46cb-bc61-cead1000a40c%2FScreen_Shot_2021-09-17_at_6.14.00_PM.png?table=block&id=77674e64-7ce4-461c-b64a-717eced59e08&cache=v2)
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB