시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 256 MB | 16 | 7 | 3 | 27.273% |
Given are Nimbers $a_1, a_2, \ldots, a_{K-1}$, $b_1, b_2, \ldots, b_5$, and $c_1, c_2, \ldots, c_5$.
Let $\displaystyle a_n = \left(\bigoplus_{i = 1}^{5} a_{n - i} \otimes b_i \right) \oplus \left(\bigoplus_{i = 1}^{5} a_{n - K + i} \otimes c_i \right)$ for all $n \ge K$.
Find the value of $a_m$.
The first line of input contains two positive integers $K$ and $m$ ($6 \le K \le 10^5$, $1 \le m \le 10^{18}$).
The second line contains $K - 1$ non-negative integers $a_1, a_2, \ldots, a_{K - 1}$ ($0 \le a_i < 2^{32}$).
The third line contains five non-negative integers $b_1, b_2, \ldots, b_5$ ($0 \le b_i < 2^{32}$).
The fourth line contains five non-negative integers $c_1, c_2, \ldots, c_5$ ($0 \le c_i < 2^{32}$).
Output a single line with a single integer: the value of $a_m$.
6 1000000000000000000 1 2 3 4 5 1 0 0 0 0 0 0 0 0 0
5
6 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
9
11 123 849 674 223 677 243 657 979 583 643 845 979 282 313 567 433 122 443 132 554 132
32098
Nimbers are non-negative integers associated with Nim games. For the purposes of this problem, two operations are necessary:
Here, $\mathrm{mex}(S)$ represents the smallest non-negative integer $d \not\in S$.