logo AlgoBeat OnlineJudge
登录 注册

#217678. [ECNA 2023] Convex Hull Extension

内存限制:2048 MiB 时间限制:4000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Dr. Hugh Klidd is a geometry expert who has recently become preoccupied with convex hulls. Recall that for a set of points in the plane, the convex hull is the smallest convex polygon containing all of those points. (A convex polygon has the property that for any two points on/in the polygon, the line segment connecting those two points lies entirely on/in the polygon.) Dr. Klidd has just computed the convex hull of a set of which he denotes and is quite pleased with the result:

  • the convex hull has vertices

  • each vertex has integer coordinates

  • no three of the convex hull vertices are collinear, i.e., lie on the same line

Dr. Klidd is ambitious, though, so he wants this convex hull to grow. Specifically, he is looking for an extension point, which is a point satisfying the following conditions:

  1. and are integers

  2. if ( with added), then the convex hull of i.e., has vertices

  3. no three of these vertices are collinear

In other words, an extension point increases the number of convex hull vertices by , while still keeping all its nice properties. For most convex hulls , Dr. Klidd can usually find at least one extension point, but he would like to know how many extension points there are to choose from. He postulates that there is an efficient way to count the number of extension points, but having never taken an algorithms course, he turns to you for help.

:::align{center} :::

输入格式

The first line of input contains an integer, the number of vertices of the convex hull that Dr. Klidd starts with This is followed by lines, each of which contains two space-separated integers, the and coordinates of one of the vertices The points are distinct, no three are collinear, and they are given in counterclockwise order.

输出格式

If the number of extension points for the convex hull specified in the input is infinite, output "infinitely many". Otherwise, output the number of extension points.

Note: Dr. Klidd has postulated exactly four things before now, so this is his fifth postulate.

样例

样例输入 1

5
0 2
-2 0
-1 -3
1 -3
2 1

样例输出 1

23

样例输入 2

4
-7 -7
7 -7
7 7
-7 7

样例输出 2

infinitely many