3D Geometry
Time limit1sMemory limit1024 MB
Given an axis-aligned tetrahedron and an axis-aligned cube in each test case, the task is to find the volume of their intersection.
- Level
Medium7 of 10
- Topics
- Geometry, Math, Implementation
- Solved
- No attempts yet
Problem
An axis-aligned tetrahedron (triangular pyramid) is a convex polyhedron in three dimensions with these vertices:
An axis-aligned cube is also a convex polyhedron, with these vertices:
Given the tetrahedron and the cube , find the volume of their intersection.
Input
The input contains several test cases and ends at end-of-file. Each test case has 4 lines. The -th line contains three integers , , and .
Output
For each test case, print the volume as a real number. Your answer is accepted if its absolute or relative error does not exceed .
Constraints
- for each
- , ,
- , ,
- The number of test cases does not exceed .