eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Untidy Desktops

Untidy Desktops

Many companies are moving towards "paperless offices" in an attempt to increase productivity. Unfortunately, people who are unorganized with papers are unorganized without papers too! Instead of having piles of paper scattered all over a desk, people have windows overlapping and covering one another. For these people, finding the right window on the computer screen is just as hard as finding the right piece of paper on the desk. For this problem, you will be given the locations and sizes of \textbf{n} windows on a computer desktop (\textbf{1} ≤ \textbf{n} ≤ \textbf{50}). You have been asked to evaluate how untidy the computer desktop is by counting the number of windows that overlap with at least one other window. Two windows overlap if at least one pixel is in both windows (including the boundary of the windows). \InputFile The input will consist of multiple cases. Each case will start with a line containing a single integer \textbf{n}. This will be followed by \textbf{n} lines of the form \textbf{r c w h} where \textbf{r}, \textbf{c} are the row and column coordinates of the upper left corner of the window, and \textbf{w}, \textbf{h} are the width and height of the window. You may assume that the upper left corner of the computer desktop has coordinates \textbf{(0, 0)}, the screen has \textbf{1024} rows and \textbf{1280} columns, and all windows are completely within the boundary of the screen. A value of \textbf{n = 0} will terminate the input. \OutputFile For each test case, print on a single line the number of windows that overlap with at least one other window.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
3
0 0 20 20
20 20 20 20
40 40 20 20
5
0 0 20 20
18 18 20 20
40 40 20 20
5 10 4 2
100 100 40 40
0
Выходные данные #1
0
3
Источник ACM ICPC East Central Regional Practice Contest 2000