問題一覧 > 通常問題

No.1444 !Andd

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

This problem is a harder version of Problem F (Andd).

Problem Statement

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

  • Change $X$ to $X \times 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 inputs are integers.
  • $1 \le N \le 2 \times 10^4$
  • $0 \le A_i < 2^{10}$

Output

Output $N$ lines.

On the $i(1 \le i \le N)$-th line, output 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
1
2

After the $1$-st operation, the only possible value of $X$ is $1$.

After the $2$-nd operation, there are $2$ possible values of $X$: $0,4$.

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

Sample 3
Input
10
26 7 10 0 10 30 21 30 31 20
Output
2
3
4
1
1
1
1
1
1
1

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