QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100

#15471. Quadrants

统计

本题关于象限。什么是象限?让我们从平面 $\mathbb{R}^2$ 上的任意两条垂直直线 $\ell$ 和 $\ell'$ 开始。如果你从整个平面 $\mathbb{R}^2$ 中减去这两条直线 $\ell$ 和 $\ell'$,你会得到四个连通的、无界的区域。这四个区域中的每一个都被称为一个象限。注意,象限的边界不属于象限本身。

现在,考虑平面 $\mathbb{R}^2$ 中的一个点集 $P$。我们对由点集 $P$ 定义的象限感兴趣。具体来说,令 $\mathcal{Q}$ 为所有满足其边界恰好包含 $P$ 中三个点的象限 $Q$ 的集合。如果一个象限 $Q \in \mathcal{Q}$ 的内部恰好包含 $k$ 个 $P$ 中的点,则称其为 $k$-象限。下图展示了一个例子,其中点集 $P$ 由 14 个点(小圆圈)组成,你可以看到一个 $Q \in \mathcal{Q}$ 的 5-象限(青色阴影部分),其边界包含三个点 $p, q, r \in P$。

给定一个包含 $n$ 个点的点集 $P$ 作为输入,编写一个程序,计算对于每个 $0 \le k \le n - 3$ 的 $k$-象限的数量。

输入格式

程序从标准输入读取数据。输入的第一行包含一个整数 $n$ ($3 \le n \le 2,000$),其中 $n$ 是输入点集 $P$ 中的点数。在接下来的 $n$ 行中,每行给出两个整数 $x$ 和 $y$,取值范围均为 $-10^6$ 到 $10^6$(包含边界),表示输入点集 $P$ 中一个点 $(x, y)$ 的 $x$ 和 $y$ 坐标。你可以假设没有两个输入点具有相同的坐标,没有三个点在同一直线上,并且不存在两条垂直直线 $\ell$ 和 $\ell'$ 使得 $|\ell \cap P| \ge 2$ 且 $|\ell' \cap P| \ge 2$。

输出格式

程序向标准输出写入数据。打印恰好 $n - 2$ 行。对于每个 $1 \le i \le n - 2$,输出的第 $i$ 行必须包含一个整数,表示相对于输入点集 $P$ 的 $(i - 1)$-象限的数量。

样例

样例输入 1

3
0 0
1 2
-1 4

样例输出 1

2

样例输入 2

4
0 0
1 2
-1 4
-1 1

样例输出 2

0
4

样例输入 3

10
47 20
4 30
3 21
44 12
46 34
18 18
19 50
48 23
22 3
19 22

样例输出 3

2
12
20
18
20
30
28
16

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.