You are using an operating system in which each application opens in a rectangular window with some level of transparency. The desktop, which lies beneath all the windows, shows a picture. A pixel in that picture is clearly visible if there are N or less windows above it.
The screen is 100 x 100 pixels. You are given int[]s x1, y1, x2 and y2. The top-left corner of the ith window is at (x1[i], y1[i]), and the bottom-right corner is at (x2[i], y2[i]). Each window covers the rectangular area between its two corner coordinates, inclusive. For example, the window from (1, 1) to (2, 2) covers exactly four pixels. Return the total number of pixels that are not visible in the desktop picture. |