QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 32 MB Total points: 10

#11664. 等高线

Statistics

考虑一组边平行于坐标轴的多边形。如果这组多边形可以进行排序,使得第一个多边形包含第二个多边形的内部,第二个多边形包含第三个多边形的内部,以此类推,那么这组多边形被称为等高线系统

你的任务是判断给定的一组多边形是否为等高线系统。

输入格式

第一行包含一个自然数 $t$ ($1 \le t \le 10$),表示需要处理的数据集数量。接下来是 $t$ 个数据集。每个数据集的第一行包含一个整数 $n$ ($1 \le n \le 250$),表示该组中多边形的数量。接下来的 $n$ 行,每行包含一个整数 $m_i$ ($4 \le m_i \le 250$, $1 \le i \le n$),表示第 $i$ 个多边形的顶点数,随后是 $m_i$ 对整数 $x_{i,j}$ 和 $y_{i,j}$ ($0 \le x_{i,j}, y_{i,j} \le 200\,000$),以空格分隔。这些坐标对描述了多边形连续顶点的坐标。每个多边形的边都平行于坐标轴。此外,多边形的任意两条相邻边均不共线。任何多边形的周长均不包含自交。

输出格式

标准输出应包含 $t$ 行。如果第 $k$ 个多边形集合是一个等高线系统,则第 $k$ 行应输出单词 TAK(波兰语中的“是”),否则输出 NIE(波兰语中的“否”)。

样例

输入 1

3
3
6 1 1 5 1 5 4 4 4 4 6 1 6
6 0 0 0 7 5 7 5 5 7 5 7 0
4 2 3 3 3 3 4 2 4
3
4 2 2 3 2 3 3 2 3
8 1 1 1 4 3 4 3 6 5 6 5 4 4 4 4 1
4 0 0 6 0 6 5 0 5
3
6 1 1 5 1 5 4 4 4 4 6 1 6
6 0 0 0 7 5 7 5 5 7 5 7 0
4 2 3 4 3 4 4 2 4

输出 1

TAK
NIE
NIE

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.