#P2924. [USACO08DEC] Largest Fence G

    ID: 1966 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2008USACO素数判断,质数,筛法凸包

[USACO08DEC] Largest Fence G

Description

Farmer John has purchased NN (5N2505 \le N \le 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. The pasture is represented as a rectilinear grid; fencepost ii is at integer coordinates (xi,yi)(x_i, y_i) (1xi1000,1yi10001 \le x_i \le 1000,1 \le y_i \le 1000).

Given the locations of NN fence posts (which, intriguingly, feature 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%45\% of the points for this problem, N65N \le 65.

Input Format

  • Line 11: A single integer: NN.

  • Lines 2N+12\dots N+1: Line i+1i+1 describes fence post ii's location with two space-separated integers: xix_i and yiy_i.

Output Format

  • Line 11: A single integer, the maximum possible number of fence posts that form a convex polygon.
6 
5 5 
2 3 
3 2 
1 5 
5 1 
1 1 

5 

Hint

A square with two points inside.

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