QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 256 MB 満点: 100 ハック可能 ✓

#7089. 三维

統計

定义三维空间中两个格点 $a = (x_a, y_a, z_a)$ 和 $b = (x_b, y_b, z_b)$ 之间的一种特殊“距离”:

$$d(a, b) = \max\{|x_a - x_b|, |y_a - y_b|, |z_a - z_b|\} \oplus x_a \oplus y_a \oplus z_a \oplus x_b \oplus y_b \oplus z_b$$

其中 $\max\{S\}$ 表示集合 $S$ 中的最大值,$|x|$ 表示 $x$ 的绝对值,$\oplus$ 表示按位异或运算符。

给定六个非负整数 $mx_a, my_a, mz_a, mx_b, my_b, mz_b$,请计算满足条件 $x_a \in [0, mx_a], y_a \in [0, my_a], z_a \in [0, mz_a]$ 以及 $x_b \in [0, mx_b], y_b \in [0, my_b], z_b \in [0, mz_b]$ 的所有格点 $a$ 和 $b$ 的 $d(a, b)$ 之和。由于总和可能非常大,请输出其对 $2^{30}$ 取模的结果。

注意 $x_a, y_a, z_a, x_b, y_b, z_b$ 均为整数。

输入格式

输入仅包含六个非负整数 $mx_a, my_a, mz_a, mx_b, my_b, mz_b$,每个整数均不超过 $10^9$。

输出格式

输出一个整数,表示总和对 $2^{30}$ 取模的结果。

样例

输入 1

3 2 1 2 1 3

输出 1

778

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.