| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 21 | 15 | 12 | 66.667% |
Consider the binary operator $\oplus_b(x, y)$ that is defined for $b \in \{2, 4\}$ as follows. First, convert both $x$ and $y$ into base $b$. Then, for each corresponding digit pair, the resulting digit can be calculated by adding the digit pair modulo $b$. Finally, convert the result back to base ten. Notice that $\oplus_2$ is the bitwise XOR operator.
For instance, $\oplus_4(18, 7) = 21$ can be calculated as follows. The base four representations of 18ドル$ and 7ドル$ are $(102)_4$ and $(013)_4,ドル respectively. After the addition for each digit pair, the result is $(111)_4,ドル or 21ドル$ in base ten.
You are given a list of $N$ integers, $A_1, A_2, \dots , A_N$.
Determine the number of pairs $(i, j)$ such that 1ドル ≤ i < j ≤ N$ and $\oplus_2(A_i , A_j ) = \oplus_4(A_i , A_j )$.
The first line consists of an integer $N$ (2ドル ≤ N ≤ 200,円 000$).
The next line consists of $N$ integers $A_i$ (0ドル ≤ A_i ≤ 10^{12}$).
Output a single integer representing the number of pairs $(i, j)$ such that 1ドル ≤ i < j ≤ N$ and $\oplus_2(A_i , A_j ) = \oplus_4(A_i , A_j )$.
5 2 2 0 1 3
9
The only pair that does not satisfy the requirements is $(4, 5),ドル because $\oplus_2(1, 3) = 2$ and $\oplus_4(1, 3) = 0$.
2 17 13
0
10 13 7 29 4 18 0 4 21 12 20
14
10 0 0 0 0 0 0 0 0 0 0
45
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2023 J번