시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 256 MB | 4 | 2 | 2 | 66.667% |
Let's define a strange "distance" between two points $a=(x_a,y_a,z_a)$ and $b=(x_b,y_b,z_b)$ in three-dimensional space:
$$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,$$
where $\max\{S\}$, $|x|$ and $\oplus$ correspond to the maximum value in $S$, the absolute value of $x$ and the bitwise exclusive-or operator respectively.
Given $6$ non-negative integers $mx_a,my_a,mz_a,mx_b,my_b,mz_b$, please find the sum of all $d(a,b)$, where $x_a \in [0, mx_a], y_a \in [0, my_a], z_a \in [0, mz_a]$ and $x_b \in [0, mx_b], y_b \in [0, my_b], z_b \in [0, mz_b]$. Since the sum may be very large, please output it modulo $2^{30}$ instead.
Note that $x_a,y_a,z_a,x_b,y_b,z_b$ should all be integers.
The input only contains $6$ non-negative integers $mx_a,my_a,mz_a,mx_b,my_b,mz_b$, each integer is not larger than $10^9$.
Output an integer denoting the sum modulo $2^{30}$.
3 2 1 2 1 3
778