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

Lonely Mountain

Lonely Mountain

\textit{"This was made by Thror, your grandfather, Thorin",} \textit{he said in answer to the dwarves’ excited questions.} \textit{"It is a plan of the Mountain."} J. R. R. Tolkien. The Hobbit, or There and Back Again The plan of the Lonely Mountain consists of two parallel projections of the mountain to two projection planes. Both planes are perpendicular to the ground and each other. Each projection has a mountain-like shape. \includegraphics{https://static.e-olymp.com/content/29/29f03aa4dece6072387c87a5dbf1f86d1bd55239.jpg} Since Bilbo Baggins has never seen the mountain, he tries to imagine it. Is it really the Lonely Mountain or some ridges and other mountains surround it? In any case, it must be tremendous to hold the whole dwarves’ kingdom! Bilbo decided to estimate the maximum possible volume of the Lonely Mountain and nearby mountains (if any) based on the plan provided by Gandalf. \InputFile The first line contains single integer number \textbf{n_x} --- the number of points in the parallel projection of the mountain to the plane \textbf{Oxz} (\textbf{2} ≤ \textbf{n_x} ≤ \textbf{100000}). The second line contains \textbf{n_x} pairs of integer numbers \textbf{x_i}, \textbf{z_i} --- the coordinates of the polygonal chain, representing the projection (\textbf{-10^9} ≤ \textbf{x_1} < \textbf{x_2} < \textbf{x_3} < ... < \textbf{x_nx} ≤ \textbf{10^9}, \textbf{0} ≤ \textbf{z_i} ≤ \textbf{10^9}, \textbf{z_1 = z_nx = 0}). The following two lines contain projection to the \textbf{Oyz} plane in the same format. \OutputFile The only line of the output file must contain a single number \textbf{V} --- the maximum possible volume of the Lonely Mountain. \includegraphics{https://static.e-olymp.com/content/a2/a20ef2c5fbf634421fcdc3a1b9eab349bb4d3254.jpg} The absolute or relative precision of you answer should be at least \textbf{10^\{-6\}}. E.g. if \textbf{V'} is the actual maximum possible volume, the following must hold: . If there are no mountains corresponding to the given projections, output a single line "\textbf{Invalid plan}".
Ліміт часу 2 секунди
Ліміт використання пам'яті 256 MiB
Вхідні дані #1
6
0 0 1 1 2 0 3 3 4 4 6 0
5
0 0 1 1 2 1 3 4 4 0
Вихідні дані #1
21.824074074074073
Вхідні дані #2
3
-1 0 0 1 2 0
4
0 0 1 1 2 2 3 0
Вихідні дані #2
Invalid plan
Джерело ACM ICPC 2013–2014, NEERC, Northern Subregional Contest, St Petersburg, October 26, 2013