#P16320. [ICPC 2023 Jinan R] 近似凸多边形

    ID: 18256 远端评测题 1000ms 1024MiB 尝试: 0 已通过: 0 显示难度提高 上传者: 标签>计算几何2023ICPC济南极角排序

[ICPC 2023 Jinan R] 近似凸多边形

Problem Description

This is a story about Kevin, who is a friend of Xiaoqingyu.

Kevin is the chief judge of the International Convex Polygon Contest (ICPC). He prepared a geometry problem for the contest. However, because he is not familiar with computational geometry, he cannot generate correct convex polygons as the testdata for this problem.

So Kevin feels upset. His good friend Xiaoqingyu comforts him like this: “Although the data you generate are not convex polygons, you can call them approximate convex polygons!”

You are given a set SS of points on the 2D plane (containing at least 33 points). The coordinates of any two points are different, and no three points are collinear. Xiaoqingyu calls a polygon PP an approximate convex polygon if and only if:

  • Polygon PP is a simple polygon. That is, all vertices of the polygon are pairwise distinct, and no two edges share any common point except that adjacent edges share a common endpoint.
  • The vertices of the polygon belong to SS, and every point in SS is either inside the polygon or on the boundary of the polygon.

Let U\mathbb{U} be the set of all approximate convex polygons. It can be proven that U\mathbb{U} is finite and non-empty. Therefore, there exists a polygon RR such that ∣R∣|R| is the minimum among all polygons in U\mathbb{U} (where ∣R∣|R| is the number of vertices of polygon RR).

Kevin and Xiaoqingyu want you to compute the number of polygons Q∈UQ \in \mathbb{U} satisfying ∣Q∣≤∣R∣+1|Q| \le |R| + 1.

Input Format

Each test file contains only one test case.

The first line contains an integer nn (3≤n≤2×1033 \le n \le 2 \times 10^3), denoting the number of points in set SS.

For the next nn lines, the ii-th line contains two integers xix_i and yiy_i (−106≤xi,yi≤106-10^6 \le x_i, y_i \le 10^6), denoting a point (xi,yi)(x_i, y_i) in set SS.

It is guaranteed that the coordinates of any two points in SS are different, and no three points are collinear.

Output Format

Output one line with one integer, denoting the number of polygons QQ.

7
1 4
4 0
2 3
3 1
3 5
0 0
2 4
9
5
4 0
0 0
2 1
3 3
3 1
5
3
0 0
3 0
0 3
1

Hint

For the first sample, ∣R∣=4|R| = 4. All polygons QQ are shown below.

:::align{center} :::

For the second sample, ∣R∣=3|R| = 3. All polygons QQ are shown below.

:::align{center} :::

Translated by ChatGPT 5