Imagine Polygons

All submissions for this problem are available.
###Read problems statements in [Hindi](http://www.codechef.com/download/translated/S19ELTST/hindi/IMPO.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/S19ELTST/mandarin/IMPO.pdf), [Russian](http://www.codechef.com/download/translated/S19ELTST/russian/IMPO.pdf), [Vietnamese](http://www.codechef.com/download/translated/S19ELTST/vietnamese/IMPO.pdf) and [Bengali](http://www.codechef.com/download/translated/S19ELTST/bengali/IMPO.pdf) as well. Once upon a time, there was the body of all bodies. It was believed that one who could calculate its volume would have good fortune. The characteristics of the body are lost; however, it was discovered that at midday (when the Sun was directly above the body), the body's shadow on the ground was a simple polygon without selfintersections with $N$ vertices, and when the sun was setting (it illuminated the body horizontally), the body's shadow on an ancient wall (perpendicular to solar rays) was a simple polygon without selfintersections with $M$ vertices. Formally, the first polygon lies in the $xy$plane and the second polygon in the $xz$plane. Those two polygons were drawn by the ancients so that their successors could solve their mystery, and yet, no one could find the volume of the body of bodies. Your task is to find out what the maximum volume of the body of all bodies could ever be. ### Input  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first line of each test case contains a single integer $N$.  Each of the following $N$ lines contains two spaceseparated integers $x$ and $y$ denoting the coordinates of one vertex of the first polygon. These vertices are given in the order in which they appear on the perimeter of the polygon.  The next line contains a single integer $M$.  Each of the following $M$ lines contains two spaceseparated integers $x$ and $z$ denoting the coordinates of one vertex of the second polygon. These vertices are also given in the order in which they appear on the perimeter of the polygon. ### Output If no body can produce the given pair of shadows, print a single line containing the integer $1$. Otherwise, print a single line containing one real number — the maximum volume. Your answer will be considered correct if its absolute or relative error does not exceed $10^{6}$. ### Constraints  $1 \le T \le 3$  $3 \le N \le 10^5$  $3 \le M \le 10^5$  $x, y, z \le 10^9$ ### Example Input ``` 2 3 0 0 10 0 0 10 4 0 0 10 0 10 2 0 2 3 0 0 10 0 0 10 4 10 0 0 0 0 10 10 10 ``` ### Example Output ``` 100 1 ``` ### Explanation **Example case 1:** The first polygon has area $50$ and the second polygon perfectly covers the first polygon, so the body of all bodies can have thickness $2$ and crosssection given by the first polygon. Then, the volume is $50 \cdot 2 = 100$. **Example case 2:** There is no body that can form these two polygons.Author:  jafarbadour 
Editorial  https://discuss.codechef.com/problems/IMPO 
Tags  computationalgeometry, hard, integrals, jafarbadour, linesweep, snckel19, taran_1407 
Date Added:  25112018 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 