No.1493 Adjacent XOR
レベル :
/ AI推定難易度 : 1700
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 107
作問者 :
penguinman
/ テスター :
kaage
noimi
タグ : / 解いたユーザー数 107
作問者 :
penguinman
/ テスター :
kaage
問題文最終更新日: 2021-05-07 23:42:57
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 293
(順位表)
の他の問題:
Problem Statement
You are given a sequence $A$ of non-negative integers of length $N$. How many different sequences can be obtained by repeating the following operation on $A$ $0$ or more times?
- Remove $2$ adjacent elements and replace them with their exclusive OR. This operation can be performed only when the length of $A$ is at least $2$.
Since the answer can be very large, find the remainder when it is divided by $10^9+7$.
Input
\(N\) \(A_1\) \(A_2\) \(\ldots\) \(A_N\)
- $1\leq N\leq 2\times 10^5$
- $0\leq A_i\lt 2^{30}$
- All inputs are integers.
Output
Print the number of different sequences, modulo $10^9+7$, on $1$ line.
Sample
Sample 1
Input
3 1 3 2
Output
4
The sequences that can be obtained as a result of the operations are the following $4$ kinds: $(1,\ 3,\ 2),\ (2,\ 2),\ (1,\ 1),\ (0)$.
Sample 2
Input
4 1 4 4 2
Output
7
Sample 3
Input
10 8 2 0 9 1 3 2 4 9 10
Output
360
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。