시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 81 | 41 | 36 | 52.174% |
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 n 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:
Find the total surface area captured in the satellite photos.
The first line contains an integer n (1 ≤ n ≤ 200 000) — the number of photos. The j-th of the following n lines is either of the form “A xj yj aj” or “B xj yj dj” representing a photo of type A or B, respectively. The xj and yj are the integer coordinates of the middle point of the photo (−1 000 ≤ xj, yj ≤ 1 000). The aj and dj are even integers (2 ≤ aj, dj ≤ 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).
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
Sample 1:
Sample 2: