F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

line symmetric

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 891    Accepted Submission(s): 173


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 $i$-th point, it still connects to the $(i-1)$-th point and the $(i+1)$-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 $T$ indicating the number of tests.

Each test begins with one line containing one integer $n$, denoting the number of points in the polygon. Then, the $i$-th line in the following $n$ lines contains two integers $x_i, y_i$, $(x_i, y_i)$ is the coordinate of the $i$-th point. For any $1 \le i < n$, the $i$-th point is connected to the $(i+1)$-th point with an edge. Also, the $n$-th point is connected to the first point.

* $1 \le T \le 40$

* $3 \le n \le 1000$

* coordinates are in the range $[-1000, 1000]$
 

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
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-22 04:36:51, Gzip enabled