No.1074 Proliferation
タグ : / 解いたユーザー数 76
作問者 :
nmnmnmnmnmnmnm
/ テスター :
Kiri8128
Problem Statement
There is a blank xy-coordinate plane.
On it, we draw rectangles with lower-left corner ($Xa$,$Ya$) and upper-right corner ($Xb$,$Yb$), containing the origin in their interior, and fill in their interiors.
Each side of a rectangle is parallel to either the x-axis or the y-axis.
The rectangles are added one at a time, from the $1$-st rectangle to the $N$-th rectangle.
Each time a rectangle is added, find by how much the total area increases.
Input
$N$ $Xa_1$ $Ya_1$ $Xb_1$ $Yb_1$ $Xa_2$ $Ya_2$ $Xb_2$ $Yb_2$ $\vdots $ $Xa_N$ $Ya_N$ $Xb_N$ $Yb_N$
$N$ is a positive integer. $1 \le N \le 40000$.
($Xa_i$,$Ya_i$) is the lower-left corner of the $i$-th rectangle.
$Xa_i$ and $Ya_i$ are negative integers. $-20000 \le Xa_i,Ya_i \le -1$.
($Xb_i$,$Yb_i$) is the upper-right corner of the $i$-th rectangle.
$Xb_i$ and $Yb_i$ are positive integers. $1 \le Xb_i,Yb_i \le 20000$.
Output
Output the answers on $N$ lines.
Print a newline at the end.
Sample
Sample 1
Input
2 -2 -2 1 1 -1 -1 2 2
Output
9 5
The area of the first rectangle is 9.
The area of the next rectangle is 9, but excluding the part overlapping the first rectangle, the area of the added part is 5.
Sample 2
Input
3 -1 -2 1 2 -2 -1 2 1 -3 -3 3 3
Output
8 4 24
Sample 3
Input
2 -1 -1 1 1 -1 -1 1 1
Output
4 0
Sometimes the area does not increase at all.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。