eolymp
bolt
Try our new interface for solving problems
Məsələlər

Cake Cutting

Cake Cutting

There is a very big rectangular (yes...) cake on the \textbf{xy}-plane, whose four corners are (\textbf{0}, \textbf{0}), (\textbf{w}, \textbf{0}), (\textbf{w}, \textbf{h}) and (\textbf{0}, \textbf{h}). Each time you're hungry, you slice a piece from the cake and eat it. Your task is to output the area of the remaining cake, after each slice. \InputFile There are several test cases. The first line contains threes integers \textbf{n}, \textbf{w}, \textbf{h} (\textbf{1} ≤ n ≤ \textbf{200,000}, \textbf{1} ≤ \textbf{w}, \textbf{h} ≤ \textbf{1000}), the number of slices, the width and the height of the cake. Each of the following n lines contains four positive real numbers \textbf{x_1}, \textbf{y_1}, \textbf{x_2}, \textbf{y_2} not greater than \textbf{1000}. That means, you slice it along the straight line connecting (\textbf{x_1}, \textbf{y_1}) and (\textbf{x_2}, \textbf{y_2}), and eat the part on the right (if any), when looking from (\textbf{x_1}, \textbf{y_1}) to (\textbf{x_2}, \textbf{y_2}). The input is terminated by end-of-file (\textbf{EOF}). The size of input file does not exceed \textbf{10} MB. \OutputFile For each slice, output the area of the cake after the slice, to at least three digits after the decimal point. We allow an absolute error of \textbf{10^\{-3\}} for each value you output.
Zaman məhdudiyyəti 2 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
2 20 10
15.0 0.0 15.0 5.0
1.0 2.0 2.0 2.0
Çıxış verilənləri #1
150.000
120.000