QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100 Difficulty: [show]

#3069. 月球景观

Statistics

一颗卫星正在勘测月球上可能的漫游车着陆区。着陆区被建模为嵌入在标准坐标系中的方格网。

卫星拍摄了 $n$ 张照片,每张照片都捕捉到了地表的一个正方形区域。精密的相机校准确保了所有照片都与网格对齐——所有四个顶点的坐标均为整数。由于卫星轨道的改变,照片分为两种类型:

  • A 类照片的边与坐标轴平行。此类照片通过给出正方形中心点的整数坐标 $(x, y)$ 及其边长 $a$(始终为偶数)来指定。
  • B 类照片的边与坐标轴成 $45^\circ$ 角。此类照片通过给出正方形中心点的整数坐标 $(x, y)$ 及其对角线长度 $d$(始终为偶数)来指定。

求卫星照片所覆盖的总表面积。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 200\,000$),表示照片的数量。接下来的 $n$ 行中,第 $j$ 行的形式为 “A $x_j$ $y_j$ $a_j$” 或 “B $x_j$ $y_j$ $d_j$”,分别代表 A 类或 B 类照片。$x_j$ 和 $y_j$ 是照片中心点的整数坐标 ($-1\,000 \le x_j, y_j \le 1\,000$)。$a_j$ 和 $d_j$ 是偶数 ($2 \le a_j, d_j \le 1\,000$),分别表示边长和对角线长度。

输出格式

输出一个数字,小数点后保留恰好两位——地表的总面积。答案必须与裁判程序的解完全一致(不允许有舍入误差)。

样例

输入 1

2
A 0 0 2
B 1 0 2

输出 1

5.00

输入 2

8
A -7 10 4
B 3 10 8
A -6 6 6
A -2 5 8
B 3 -1 8
B -7 -4 8
A 3 9 2
B 8 6 6

输出 2

205.50

说明

样例 1

样例 2

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

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.