103434: [Atcoder]ABC343 E - 7x7x7

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:25 Solved:0

Description

Score: $475$ points

Problem Statement

In a coordinate space, we want to place three cubes with a side length of $7$ so that the volumes of the regions contained in exactly one, two, three cube(s) are $V_1$, $V_2$, $V_3$, respectively.

For three integers $a$, $b$, $c$, let $C(a,b,c)$ denote the cubic region represented by $(a\leq x\leq a+7) \land (b\leq y\leq b+7) \land (c\leq z\leq c+7)$.

Determine whether there are nine integers $a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3$ that satisfy all of the following conditions, and find one such tuple if it exists.

  • $|a_1|, |b_1|, |c_1|, |a_2|, |b_2|, |c_2|, |a_3|, |b_3|, |c_3| \leq 100$
  • Let $C_i = C(a_i, b_i, c_i)\ (i=1,2,3)$.
    • The volume of the region contained in exactly one of $C_1, C_2, C_3$ is $V_1$.
    • The volume of the region contained in exactly two of $C_1, C_2, C_3$ is $V_2$.
    • The volume of the region contained in all of $C_1, C_2, C_3$ is $V_3$.

Constraints

  • $0 \leq V_1, V_2, V_3 \leq 3 \times 7^3$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

$V_1$ $V_2$ $V_3$

Output

If no nine integers $a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3$ satisfy all of the conditions in the problem statement, print No. Otherwise, print such integers in the following format. If multiple solutions exist, you may print any of them.

Yes
$a_1$ $b_1$ $c_1$ $a_2$ $b_2$ $c_2$ $a_3$ $b_3$ $c_3$

Sample Input 1

840 84 7

Sample Output 1

Yes
0 0 0 0 6 0 6 0 0

Consider the case $(a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3) = (0, 0, 0, 0, 6, 0, 6, 0, 0)$.

The figure represents the positional relationship of $C_1$, $C_2$, and $C_3$, corresponding to the orange, cyan, and green cubes, respectively.

Here,

  • All of $|a_1|, |b_1|, |c_1|, |a_2|, |b_2|, |c_2|, |a_3|, |b_3|, |c_3|$ are not greater than $100$.
  • The region contained in all of $C_1, C_2, C_3$ is $(6\leq x\leq 7)\land (6\leq y\leq 7) \land (0\leq z\leq 7)$, with a volume of $(7-6)\times(7-6)\times(7-0)=7$.
  • The region contained in exactly two of $C_1, C_2, C_3$ is $((0\leq x < 6)\land (6\leq y\leq 7) \land (0\leq z\leq 7))\lor((6\leq x\leq 7)\land (0\leq y < 6) \land (0\leq z\leq 7))$, with a volume of $(6-0)\times(7-6)\times(7-0)\times 2=84$.
  • The region contained in exactly one of $C_1, C_2, C_3$ has a volume of $840$.

Thus, all conditions are satisfied.

$(a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3) = (-10, 0, 0, -10, 0, 6, -10, 6, 1)$ also satisfies all conditions and would be a valid output.


Sample Input 2

343 34 3

Sample Output 2

No

No nine integers $a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3$ satisfy all of the conditions.

Input

Output

得分:475分

问题描述

在一个坐标空间中,我们希望放置三个边长为7的立方体,使得正好被一个、两个、三个立方体包含的区域的体积分别为$V_1$、$V_2$、$V_3$。

对于三个整数$a$、$b$、$c$,令$C(a,b,c)$表示由$(a\leq x\leq a+7) \land (b\leq y\leq b+7) \land (c\leq z\leq c+7)$表示的立方体区域。

确定是否存在九个整数$a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3$满足以下所有条件,并在存在这样的元组时找到一个。

  • $|a_1|, |b_1|, |c_1|, |a_2|, |b_2|, |c_2|, |a_3|, |b_3|, |c_3| \leq 100$
  • 令$C_i = C(a_i, b_i, c_i)\ (i=1,2,3)$。
    • 正好被$C_1, C_2, C_3$中的一个立方体包含的区域的体积为$V_1$。
    • 正好被$C_1, C_2, C_3$中的两个立方体包含的区域的体积为$V_2$。
    • 正好被$C_1, C_2, C_3$中的三个立方体包含的区域的体积为$V_3$。

约束条件

  • $0 \leq V_1, V_2, V_3 \leq 3 \times 7^3$
  • 所有输入值都是整数。

输入

输入从标准输入以以下格式给出:

$V_1$ $V_2$ $V_3$

输出

如果没有九个整数$a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3$满足问题描述中的所有条件,输出No。否则,以以下格式输出这样的整数。如果存在多个解,你可以输出其中任何一个。

Yes
$a_1$ $b_1$ $c_1$ $a_2$ $b_2$ $c_2$ $a_3$ $b_3$ $c_3$

样例输入1

840 84 7

样例输出1

Yes
0 0 0 0 6 0 6 0 0

考虑$(a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3) = (0, 0, 0, 0, 6, 0, 6, 0, 0)$的情况。

该图表示了$C_1$、$C_2$和$C_3$的位置关系,分别对应着橙色、青色和绿色的立方体。

这里,

  • 所有$|a_1|, |b_1|, |c_1|, |a_2|, |b_2|, |c_2|, |a_3|, |b_3|, |c_3|$都不大于100。
  • 正好被$C_1, C_2, C_3$中的三个立方体包含的区域是$(6\leq x\leq 7)\land (6\leq y\leq 7) \land (0\leq z\leq 7)$,体积为$(7-6)\times(7-6)\times(7-0)=7$。
  • 正好被$C_1, C_2, C_3$中的两个立方体包含的区域是$((0\leq x < 6)\land (6\leq y\leq 7) \land (0\leq z\leq 7))\lor((6\leq x\leq 7)\land (0\leq y < 6) \land (0\leq z\leq 7))$,体积为$(6-0)\times(7-6)\times(7-0)\times 2=84$。
  • 正好被$C_1, C_2, C_3$中的一个立方体包含的区域的体积为840。

因此,所有条件都得到了满足。

$(a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3) = (-10, 0, 0, -10, 0, 6, -10, 6, 1)$也满足所有条件,是一个有效的输出。


样例输入2

343 34 3

样例输出2

No

不存在九个整数$a_1, b_1, c_1, a_2, b_2, c_2, a_3, b_3, c_3$满足所有条件。

加入题单

上一题 下一题 算法标签: