QOJ.ac

QOJ

時間限制: 3 s 記憶體限制: 512 MB 總分: 100 可 Hack ✓

#281. 开放空间

统计

Yandex 办公室的每一层都包含几个位于同一平面上的开放空间。第 $i$ 号员工坐在办公桌前,为了简化起见,我们假设办公桌是一个坐标为 $(x_i, y_i)$ 的点。已知每位员工都隶属于一个团队,且每个团队都在为 Yandex 从事某项非常有价值的工作。当然,公司里没有员工共用一张办公桌。

每个团队的所有成员都位于某个凸多边形的顶点上。虽然这些多边形可能会相交,但它们不会在顶点处相遇。此外,同一个团队中没有三张办公桌是共线的。

没人记得为什么会有这样奇怪的要求,但员工安置部门一直在努力满足这些要求。

该部门的日常职责之一是计算每对团队多边形之间不同公共外公切线的数量。两个多边形的公共外公切线是一条与每个多边形的边界接触一点或多点的直线,使得两个多边形的所有内点都位于该直线的同一侧。

请帮助员工安置部门实现此任务的自动化,已知 Yandex 的员工总数不超过 $10^5$ 人。

请记住,该部门还有许多其他重要工作要做,因此请确保您的解决方案尽可能高效。我们也强烈建议使用 64 位编译器进行测试。

输入格式

输入的第一行包含一个整数 $N$,表示 Yandex 中不同团队的数量 ($1 \le N \le 400$)。

接下来是 $N$ 个团队的描述。

每个描述以一行整数 $N_i$ 开头:第 $i$ 个团队的成员数量 ($3 \le N_i \le 10^5$)。接下来是 $N_i$ 行,每行一对整数。一对 $x_{ij}, y_{ij}$ 表示第 $i$ 个团队中第 $j$ 个成员的平面坐标 ($-10^9 \le x_{ij}, y_{ij} \le 10^9$)。

保证所有 $N_i$ 的总和不超过 $10^5$。

同一个团队内成员的坐标按逆时针顺序给出。

输出格式

输出 $N$ 行,每行包含 $N$ 个以空格分隔的整数。

第 $i$ 行的第 $j$ 个数字 ($j \neq i$) 必须等于第 $i$ 个团队和第 $j$ 个团队的公共外公切线数量。

第 $i$ 行的第 $i$ 个数字必须始终为零。

样例

样例输入 1

3
4
3 1
8 1
8 6
3 6
3
5 0
13 5
2 7
4
2 5
9 1
12 2
3 8

样例输出 1

0 6 4
6 0 6
4 6 0

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.