QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 64 MB 満点: 10

#11841. 云 [A]

統計

今天,Byteman 教授将使用特制的激光炮,在人类历史上首次尝试与外星人取得联系。不幸的是,天空中布满了厚厚的云层。由于教授还无法预测风向,他尚不知道激光炮的最佳位置。Byteman 想要知道,在最坏的情况下(假设激光炮位置和风向的组合最不利),云层最多会造成多少次传输中断。

为了简化问题,我们假设 Bytean 天空中的云是包含其边界的简单多边形,且任意两朵不同的云没有公共点。Byteland 的风一旦开始吹,就会始终沿同一方向吹,导致所有云朵以相同的速度向同一方向移动。Byteman 的激光炮可以看作一个点,它持续向正上方发射激光束。当激光束穿过云层时,就会发生一次传输中断。

请编写一个程序:

  • 从标准输入读取天空中云层分布的描述;
  • 计算可能发生的最大传输中断次数;
  • 将结果输出到标准输出。

输入格式

标准输入的第一行包含一个正整数 $n$,表示 Bytean 天空中云的数量。接下来的 $n$ 行包含云的描述,每朵云占一行。每行描述由一个整数 $n_{i}$ ($n_{i} \ge 3$) 开始,表示该云朵多边形的边数,随后是 $2n_{i}$ 个整数,以空格分隔,表示多边形顶点的笛卡尔坐标。所有坐标均在 $[-10^{9}, 10^{9}]$ 范围内。所有云朵的顶点总数不超过 $2\,000$。

输出格式

标准输出的第一行且仅包含一个整数,表示 Byteman 与外星人通信可能发生的最大中断次数。

样例

输入 1

2
5 1 1 5 1 5 4 3 2 1 4
3 2 4 3 5 4 4

输出 1

3

说明 1

当风沿向量 $[0, -1]$ 方向吹时,将激光炮放置在点 $(3, 0)$ 会导致 2 次传输中断。最大传输中断次数(3 次)可以通过例如将激光炮放置在点 $(0, 4)$ 且风沿向量 $[-1, 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.