QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 2048 MB Total points: 100

#2652. 冰山

Statistics

Tania 是一位海洋生物学家。她的目标是衡量气候变化对通心粉企鹅种群的影响。像大多数企鹅物种一样,通心粉企鹅生活在南半球,靠近南极洲。Tania 主要关注“Îles Nuageuses”(英语为“Cloudy Islands”,即多云群岛)附近的通心粉企鹅种群。

夏季期间,岛屿周围的冰层融化,岛屿变得太小,无法容纳所有的鸟类。一些企鹅生活在漂浮的冰山上。为了进行研究,Tania 需要测量这些冰山的面积。

利用卫星图像和图像识别技术,Tania 获得了一张冰山地图,你的目标是测量它们的面积。Tania 研究的岛屿很小,地球在局部可以近似为一个平面。因此,Tania 的地图使用了常见的二维笛卡尔坐标系,面积按常规方式计算。例如,由方程 $x_1 \leqslant x \leqslant x_2$ 和 $y_1 \leqslant y \leqslant y_2$ 定义的平行于坐标轴的矩形,其面积为 $(x_2 - x_1) \times (y_2 - y_1)$。

在 Tania 的表示中,冰山是一个由其边界表示的多边形。对于每座冰山,Tania 记录了定义冰山边界的点序列 $p_1, \dots, p_k$。不同的冰山从不相互接触,也从不重叠。此外,冰山的边界 $p_1, \dots, p_k$ 总是一个“简单”多边形,即 $[p_1; p_2], \dots, [p_k; p_1]$ 中的任意两条线段都不会相交。

输入格式

输入包含以下行: 第一行是一个整数 $N$,描述多边形的数量; 接下来是 $N$ 个块,每个块描述一个多边形,包含: 第一行是一个整数 $P$,表示定义多边形边界的点数; 接下来的 $P$ 行,每行包含两个空格分隔的整数 $x$ 和 $y$,表示每个边界点的坐标。

数据范围

  • 多边形的数量 $N$ 满足 $1 \leqslant N \leqslant 1000$。
  • 每个多边形由 $P$ 个点描述,满足 $3 \leqslant P \leqslant 50$。
  • 所有坐标满足 $0 \leqslant x, y \leqslant 10^6$。

输出格式

输出应包含一个整数:总面积向下取整后的值。换句话说,输出应为单行,包含一个整数 $I$,使得输入中描述的多边形总面积 $A$ 满足 $I \leqslant A < I + 1$。

样例

样例输入 1

1
4
0 0
1 0
1 1
0 1

样例输出 1

1

说明 1

该样例中只有一座冰山,是一个边长为 1 的正方形。

样例输入 2

2
5
98 35
79 90
21 90
2 36
50 0
3
0 0
20 0
0 20

样例输出 2

6100

说明 2

在该样例中(如下图所示),有两座冰山,一个面积为 200 的三角形和一个面积为 5900.5 的五边形。

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.