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

Unreal Estate

Unreal Estate

A dishonest landowner is selling off plots of land. He’s selling it in large, rectangular plots, but many of the plots overlap, so he’s actually selling the same land multiple times! It’s not real estate, it’s unreal estate! Given a description of the possibly overlapping rectangular plots of land that the dishonest landowner has sold, determine the total actual area of land covered by them. \InputFile There will be several test cases in the input. Each test case will begin with a line with a single integer \textbf{n} (\textbf{0} < \textbf{n} ≤\textbf{5000}), indicating the number of plots of land sold. The next \textbf{n} lines will each have a description of a rectangular plot of land, consisting of four real numbers: \textbf{x_1 y_1 x_2 y_2} where \textbf{(x_1, y_1)} is the southwest corner, and \textbf{(x_2, y_2)} is the northeast corner (\textbf{-1000} ≤ \textbf{x_1} < \textbf{x_2} ≤ \textbf{1000}, \textbf{-1000} ≤ \textbf{y_1} < \textbf{y_2} ≤\textbf{1000}). Every plot will have an area of at least \textbf{1}. The input will end with a line with a single \textbf{0}. \OutputFile For each test case, output a single real number, which represents the total actual area covered by all of the rectangular plots of land. Output this number with exactly two decimal places, rounded. Do not print any spaces. Do not print any blank lines between outputs.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Джерело The University of Chicago Invitational Programming Contest 2013, March 29-31, 2013