A1180 | [COCI-2008_2009-olympiad]#3 PLAHTE
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Mirko washed his sheets and is on his way to hang them to dry in front of his house. However, strong winds have pulled the clothesline out of the ground so Mirko temporarily laid out the sheets on the grass.
The grass field can be modeled by an infinite square grid, where every unit square is represented by a pair of coordinates. Sheets are rectangles in the grid with sides parallel to the coordinate axes. Sheets may overlap.
In an effort to put his clothesline back up, Mirko slammed a pole into the ground at coordinates (0, 0).
An entirely unexpected turn of events followed. Oil sprung from the ground and the shock caused Mirko to faint. While Mirko lay unconscious, the oil is spreading, staining his sheets.
Time is measured from the moment the oil starts spreading – at time zero only square (0, 0) is covered in oil. The oil is spreading at a speed of one square per second in all eight directions, as shown in the figure below. When oil enters a square, it stains that square of fabric on all sheets covering the square.
Write a program that, given M points in time, calculates the total area of stained fabric on all sheets for each of the given time points.
The grass field can be modeled by an infinite square grid, where every unit square is represented by a pair of coordinates. Sheets are rectangles in the grid with sides parallel to the coordinate axes. Sheets may overlap.
In an effort to put his clothesline back up, Mirko slammed a pole into the ground at coordinates (0, 0).
An entirely unexpected turn of events followed. Oil sprung from the ground and the shock caused Mirko to faint. While Mirko lay unconscious, the oil is spreading, staining his sheets.
Time is measured from the moment the oil starts spreading – at time zero only square (0, 0) is covered in oil. The oil is spreading at a speed of one square per second in all eight directions, as shown in the figure below. When oil enters a square, it stains that square of fabric on all sheets covering the square.
Write a program that, given M points in time, calculates the total area of stained fabric on all sheets for each of the given time points.
输入格式
The first line contains an integer N (1 ≤ N ≤ 100000), the number of sheets.
Each of the following N lines contains four integers x1, y1, x2 and y2 (−1 000 000 ≤ x1 ≤ x2 ≤ 1 000 000),
(−1 000 000 ≤ y1 ≤ y2 ≤ 1 000 000). The coordinates (x1, y1) and (x2, y2) represent diagonally opposite corners of a sheet (again, these coordinates are unit squares, not points on the plane). None of the sheets will cover the square (0, 0).
The next line contains an integer M (1 ≤ M ≤ 100000), the number of points in time.
The next line contains M integers between 0 and 1 000 000, the time points. They will be given in strictly ascending order.
Each of the following N lines contains four integers x1, y1, x2 and y2 (−1 000 000 ≤ x1 ≤ x2 ≤ 1 000 000),
(−1 000 000 ≤ y1 ≤ y2 ≤ 1 000 000). The coordinates (x1, y1) and (x2, y2) represent diagonally opposite corners of a sheet (again, these coordinates are unit squares, not points on the plane). None of the sheets will cover the square (0, 0).
The next line contains an integer M (1 ≤ M ≤ 100000), the number of points in time.
The next line contains M integers between 0 and 1 000 000, the time points. They will be given in strictly ascending order.
输出格式
For each of the time points, output on a separate line the total area of stained fabric on all sheets, in the order the time points are given in the input.
输入输出样例
输入 #1
3 -2 1 1 2 1 0 2 1 -3 -3 -2 0 2 1 2
输出 #1
5 15
输入 #2
4 5 1 8 4 -8 1 -5 4 -10 2 10 3 6 0 8 10 6 1 2 3 4 7 9
输出 #2
0 5 14 18 70 100
输入 #3
1 1 1 1000000 1000000 3 100 10000 1000000
输出 #3
10000 100000000 1000000000000
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted