|
||||||||||
Silly KekeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 101 Accepted Submission(s): 4 Special Judge Problem Description Keke encountered another problem. The teacher gave her a part formed by the intersection of several prisms and asked her to find the volume of the part. But her brain doesn't work that she can't finish the work even in very simple cases. Therefore, she urgently needs your help. To simplify the problem, the part is formed by the intersection of two infinitely long convex right prisms A and B. All joining edges of A are parallel to the $z$-axis, and all joining edges of B are parallel to the $x$-axis. If A and B do not intersect, Keke's teacher thinks that the part has a volume of 0. Now Keke wants you to help her find the volume of the part. Input There are mutiple test cases, the number of which is no more than 10. For each test case: The first line of input contains two integers $n$ and $m$ $(3\leq n, m\leq10^5)$, which represent the number of vertices of the base polygon of A and B respectively. Following input $n$ lines, each line has $2$ real numbers, representing the vertex coordinates $(x, y) (-100\leq x, y\leq100)$ of the base polygon of A. Following input $m$ lines, each line has $2$ real numbers, representing the vertex coordinates $(y, z) (-100\leq y, z\leq100)$ of the base polygon of B. The input guarantees that the vertices of each polygon are given in clockwise or counterclockwise order. Numbers in the same line are separated by spaces. For more detailed input information, please see the sample. Output For each test case: The first line of output should contain a non-negative real number, representing the volume of the part, accurate at least to 0.001. Sample Input
Sample Output
Hint Windows gcc don't support long double yet, output with double instead. Source | ||||||||||
|