Time Limit: 0.5 second(s) | Memory Limit: 32 MB |
You are given n cubes, each cube is described by two points in 3D space: (x_{1}, y_{1}, z_{1}) being one corner of the cube and (x_{2}, y_{2}, z_{2}) being the opposite corner. Assume that the sides of each of the cubes are parallel to the axis. Your task is to find the volume of their intersection.
Input starts with an integer T (≤ 100), denoting the number of test cases.
Each case starts with a line containing an integer n (1 ≤ n ≤ 100). Each of the next n lines contains six integers x_{1} y_{1} z_{1} x_{2} y_{2} z_{2} (1 ≤ x_{1}, y_{1}, z_{1}, x_{2}, y_{2}, z_{2} ≤ 1000, x_{1} < x_{2}, y_{1} < y_{2}, z_{1} < z_{2}) where (x_{1}, y_{1}, z_{1}) is the co-ordinate of one corner and (x_{2}, y_{2}, z_{2}) is the co-ordinate of the opposite corner.
For each case, print the case number and volume of their intersection.
Sample Input |
Output for Sample Input |
2 2 1 1 1 3 3 3 1 1 1 2 2 2 3 7 8 9 20 20 30 2 2 2 50 50 50 13 14 15 18 30 40 |
Case 1: 1 Case 2: 450 |
Developed and Maintained by
JANE ALAM JAN |
Copyright © 2012
LightOJ, Jane Alam Jan |