N by N chessboard with N queens
Given an chessboard and queens with their coordinates, you are asked if there are any two queens that attack each other.
Input
The first line of the input contains a single integer
.The next
lines contain the
coordinates of the queens . Output
The program should print
Yes
in case there are queens attacking each other and No
otherwise. Examples
Input | Output |
4
1 2
2 4
3 1
4 3 | No |
4
1 1
2 3
3 4
4 2 | Yes |
Explanation
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F252603a2-6376-479e-ae78-f156159f153e%2FScreen_Shot_2022-11-01_at_11.01.56_AM.png?table=block&id=63d91f87-da93-42d7-a59b-71ee35adc1a4&cache=v2)
Example 1
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5b4c440e-38b6-4d04-b2c3-cad1f8732523%2FScreen_Shot_2022-11-01_at_11.02.47_AM.png?table=block&id=4ef634d1-cbfc-4eda-a49d-095e92b72a24&cache=v2)
Example 2
Β
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB