#P7312. Sunlit Rectangles
Sunlit Rectangles
Sunlit Rectangles
Slavko had an unusual dream. On a sunny morning, N white rectangles climbed, one after the other, onto Slavko's rooftop and lay out in the sun. Each rectangle is placed on the roof such that its sides are parallel to the edges of the roof. Some rectangles may partially or completely cover earlier ones. The i-th rectangle has dimensions \(A_i\) by \(B_i\) and its bottom-left corner is at a distance of \(X_i\) from the left edge and \(Y_i\) from the bottom edge of the roof.
After sunset, the rectangles leave the roof and sleep. The next day, they discover that some of them have turned yellow while others remain white. A rectangle turns yellow if and only if it was completely exposed to sunlight, that is, no part of it was covered by any rectangle that came later.
Determine for each rectangle whether it turned yellow.
inputFormat
The first line contains an integer \(N\) representing the number of rectangles. Each of the next \(N\) lines contains four integers \(A_i, B_i, X_i, Y_i\), where \(A_i\) and \(B_i\) are the width and height of the rectangle respectively, and \(X_i\) and \(Y_i\) are the distances from the left and bottom edges of the roof. The rectangles are given in the order they climbed onto the roof.
outputFormat
Output \(N\) lines. For the \(i\)-th line, print \(1\) if the \(i\)-th rectangle was completely exposed to sunlight (turned yellow), or \(0\) otherwise.
sample
3
4 3 1 2
3 2 2 3
2 2 3 4
1
1
1
</p>