#abc361b. B - Intersection of Cuboids
B - Intersection of Cuboids
Score : points
问题陈述
你正在尝试在3D游戏中实现碰撞检测。
在三维空间中,让 表示一个长方体,其对角线连接点 和 ,并且所有面都与 平面、 平面或 平面平行。 (这个定义唯一确定了 。)
给定两个长方体 和 ,确定它们的交集是否具有正体积。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are trying to implement collision detection in a 3D game.
In a -dimensional space, let denote the cuboid with a diagonal connecting and , and with all faces parallel to the -plane, -plane, or -plane.
(This definition uniquely determines .)
Given two cuboids and , determine whether their intersection has a positive volume.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if the intersection of the two cuboids has a positive volume, and No
otherwise.
Sample Input 1
0 0 0 4 5 6
2 3 4 5 6 7
Sample Output 1
Yes
The positional relationship of the two cuboids is shown in the figure below, and their intersection has a volume of .
Sample Input 2
0 0 0 2 2 2
0 0 2 2 2 4
Sample Output 2
No
The two cuboids touch at a face, where the volume of the intersection is .
Sample Input 3
0 0 0 1000 1000 1000
10 10 10 100 100 100
Sample Output 3
Yes