UOJ Logo 黑暗爆炸OJ

DARKBZOJ

#1591. [Usaco2008 Dec]Largest Fence 最大的围栏

Statistics 下载数据

Description

Farmer John has purchased N (5 <= N <= 250) fence posts in order to build a very nice-looking fence.
 Everyone knows the best fences are convex polygons where fence posts form vertices of a polygon. Th
e pasture is represented as a rectilinear grid; fencepost i is at integer coordinates (x_i, y_i) (1 
<= x_i <= 1,000; 1 <= y_i <= 1000). Given the locations of N fence posts (which, intriguingly, featu
re no set of three points which are collinear), what is the largest number of fence posts FJ can use
 to create a fence that is convex? For test cases worth 45% of the points for this problem, N <= 65.
 Farmer John
有n(5≤n≤250)个栅栏点,他需要围成一个栅栏圈,这个圈是一个凸包并且凸包上的点最多....

Input

Line 1: A single integer: 
N * Lines 2..N+1: Line i+1 describes fence post i's location with two space-separated integers: x_i and y_i

Output

* Line 1: A single integer, the maximum possible number of fence posts that form a convex polygon.

Sample Input

6
5 5
2 3
3 2
1 5
5 1
1 1
INPUT DETAILS:
A square with two points inside.

Sample Output

5
The largest convex polygon is the pentagon (2,3), (3,2), (5,1), (5,5), (1,5).

Hint

Source

Gold