luogu#P4750. [CERC2017] Lunar Landscape

[CERC2017] Lunar Landscape

题目描述

A satellite is surveying a possible rover landing area on the moon. The landing area is modeled as a square grid embedded in the standard coordinate system.

The satellite has taken nn photos, each capturing a square area of the surface. Careful camera calibration has ensured that all photos are aligned with the grid — all four vertices have integer coordinates. Due to the satellite’s changing orbit there are two types of photos:

  • Photos of type A have sides that are parallel to coordinate axes. Such a photo is specified by giving the integer coordinates (x,y)(x, y) of the square’s middle point and the length of its side aa — always an even integer.
  • Photos of type B have sides at a 4545^{\circ} angle to the coordinate axes. Such a photo is specified by giving the integer coordinates (x,y)(x, y) of the square’s middle point and the length of its diagonal dd — always an even integer.

Find the total surface area captured in the satellite photos.

输入格式

The first line contains an integer n(1n200000)n(1 \le n \le 200 000) — the number of photos. The jthj-th of the following nn lines is either of the form “A xj yj ajA \ x_j \ y_j \ a_j” or “B xj yj djB \ x_j \ y_j \ d_j” representing a photo of type A or B,respectively.

The xjx_j and yjy_j are the integer coordinates of the middle point of the photo (1000xj,yj1000)(-1 000 \le x_j, y_j \le 1 000). The aja_j and djd_j are even integers (2aj,dj1000)(2 \le a_j, d_j \le 1 000) — the side length and the diagonal length, respectively.

输出格式

Output a number with exactly two digits after the decimal point — the total area of the surface. The answer has to exactly correspond to the judge’s solution (no rounding errors are tolerated).

题目大意

(具体字母格式懒得操作)

月球的景观

题目描述

一个卫星正在为探测车在月球上寻找一个合适的降落区。降落区被看做在平面直角坐标系中的一个方形区域。

这颗卫星已经照了n张照片,每张照片都涵盖了月球表面的一块正方形区域。经过对相机的精细校准,可以保证所有照片涵盖的区域都和坐标对齐——正方形四个角的坐标都为整数。由于卫星的轨道一直在变化,所以照片有两种形式: ·A类照片的边缘和坐标轴平行。对于这样的照片,题目将会给出它中心的坐标(x,y)和它的边长a(a为偶数)。 ·B类照片的边缘和坐标轴呈45°角。对于这样的照片,题目将会给出它中心的坐标(x,y)和它对角线的长度d(d为偶数)。

求出卫星图片拍摄到平面的总大小。

输入输出格式

输入格式:

第一行有一个整数n(1≤n≤200000)表示照片的数量。接下来n行中第j行的格式是"A xj yj aj"或"B xj yj dj" ,分别表示这张照片的类型是A或B。

xj和yj是这张图片中心的坐标(1000≤xj,yj≤1000)。aj和dj为偶数(2≤aj,dj≤1000),分别表示正方形的边长和对角线长度。

输出格式:

输出平面总的大小,保留两位小数。答案必须和标准答案严格相等(精度问题零容忍↖(^ω^)↗)。

2
A 0 0 2
B 1 0 2
5.00
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

205.50