#P7705. [2019年杭电多校]line symmetric
[2019年杭电多校]line symmetric
line symmetric
Problem Description
You are given a simple polygon in a two-dimensional plane. Please check whether we can move at most one point such that the simple polygon becomes a line-symmetric simple polygon. Note that you cannot reorder these points. If you move the -th point, it still connects to the -th point and the -th point in the original order. Also, you cannot move a point to a location having an existing point.
Input
The first line contains an integer indicating the number of tests. Each test begins with one line containing one integer , denoting the number of points in the polygon. Then, the -th line in the following lines contains two integers , is the coordinate of the -th point. For any , the -th point is connected to the -th point with an edge. Also, the -th point is connected to the first point.
- coordinates are in the range
Output
For each test, if you can move at most one point making the polygon line-symmetric, print a character 'Y' in a line, otherwise print a character 'N' in a line. Please note that the final polygon also has to be a simple polygon.
Sample Input
3
3
1 1
1 2
2 2
4
1 1
1 2
2 2
2 1
7
10 0
5 1
6 2
2 3
2 8
11 7
8 5
Sample Output
Y
Y
N
Source
2019 Multi-University Training Contest 5