2469. Largest Fence

单点时限: 10.0 sec

内存限制: 256 MB

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.

The 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, 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?

输入格式

  • 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

输出格式

  • Line 1: A single integer, the maximum possible number of fence posts

that form a convex polygon.

样例

Input
6
5 5
2 3
3 2
1 5
5 1
1 1
INPUT DETAILS:
A square with two points inside.
Output
5
OUTPUT DETAILS:
The largest convex polygon is the pentagon (2,3), (3,2), (5,1), (5,5), (1,5).

4 人解决,7 人已尝试。

23 份提交通过,共有 46 份提交。

7.7 EMB 奖励。

创建: 15 年,9 月前.

修改: 7 年,2 月前.

最后提交: 1 年,4 月前.

来源: USACO 2008 DEC

题目标签