Time Limit: 1000MS | | Memory Limit: 10000K |
Total Submissions: 12337 | | Accepted: 3451 |
Description
Being the only living descendant of his grandfather, Kamran the Believer inherited all of the grandpa's belongings. The most valuable one was a piece of convex polygon shaped farm in the grandpa's birth village. The farm was originally separated from the neighboring farms by a thick rope hooked to some spikes (big nails) placed on the boundary of the polygon. But, when Kamran went to visit his farm, he noticed that the rope and some spikes are missing. Your task is to write a program to help Kamran decide whether the boundary of his farm can be exactly determined only by the remaining spikes.
Input
The first line of the input file contains a single integer t (1 <= t <= 10), the number of test cases, followed by the input data for each test case. The first line of each test case contains an integer n (1 <= n <= 1000) which is the number of remaining spikes. Next, there are n lines, one line per spike, each containing a pair of integers which are x and y coordinates of the spike.
Output
There should be one output line per test case containing YES or NO depending on whether the boundary of the farm can be uniquely determined from the input.
Sample Input
16 0 01 23 42 02 4 5 0
Sample Output
NO
/*poj 1228 稳定凸包给你n个节点构成一个凸包,问再添加节点是否能够形成新的凸包比如: 这个点构成正方形可以看成一个不稳定凸包 ___ ___| | --> / ||___| --> \___|当一条边上有3个或者以上的点时,无论你怎么添加都无法改变的当逆时针旋转的时候,凸包可以看成 每次只能左转或者直走构成的一个图形当3个点一条线时,如果添加在凸包外面,那么它必需右转才可能经过那个点所以我能需要求出凸包然后判断它们是否每条边上都有3个点即可一个不错的图解:http://www.cnblogs.com/xdruid/archive/2012/06/20/2555536.htmlhhh-2016-05-07 22:17:34*/#include #include #include #include #include #include #include #include #include #include