問題一覧 > 通常問題

No.1443 Andd

レベル : / AI推定難易度 : 1800 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 56
作問者 : first_vil / テスター : iaNTU
お気に入りにしたユーザー ProblemId : 5823 / 自分の提出
問題文最終更新日: 2021-03-21 19:28:54
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 288 (順位表) の他の問題:

From the Problem Setter

Problem G (!Andd) is a harder version of this problem.

Problem Statement

There is a sequence $A$ of non-negative integers of length $N$ and a variable $X=0$. Vil will now perform the following operation for $i=1,2,\dots,N$, in this order.

  • Change $X$ to either $X+A_i$ or $X\ \mathrm{AND}\ A_i$.

Here, $\mathrm{AND}$ denotes the bitwise AND.

For each $i(1 \le i \le N)$, find the number of distinct values that $X$ can take after the $i$-th operation.

Input

$N$
$A_1\ A_2\ \dots\ A_N$
  • All input values are integers.
  • $1 \le N \le 2 \times 10^4$
  • $0 \le A_i < 2^{10}$

Output

Print $N$ lines.

On the $i(1 \le i \le N)$-th line, print the number of distinct values that $X$ can take after the $i$-th operation, followed by a newline.

It can be proved that all answers are less than $2^{31}$ under the given constraints.

Sample

Sample 1
Input
2
1 4
Output
2
3

After the $1$st operation, $X$ can take $2$ distinct values: $0,1$.

After the $2$nd operation, $X$ can take $3$ distinct values: $0,4,5$.

Sample 2
Input
4
30 29 16 26
Output
2
4
5
9

Sample 3
Input
10
26 7 10 0 10 30 21 30 31 20
Output
2
4
6
6
9
17
22
34
60
63

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。