結果

問題 No.1444 !Andd
ユーザー gew1fw
提出日時 2025-06-12 21:08:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 766 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,640 KB
実行使用メモリ 293,820 KB
最終ジャッジ日時 2025-06-12 21:09:31
合計ジャッジ時間 3,927 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

current_set = set()
current_set.add(1)
has_zero = False

for a in A:
    new_set = set()
    new_has_zero = False

    # Process current elements
    for x in current_set:
        mul = x * a
        and_val = x & a
        new_set.add(mul)
        new_set.add(and_val)
        if mul == 0:
            new_has_zero = True
        if and_val == 0:
            new_has_zero = True

    # Process zero from previous has_zero
    if has_zero:
        new_set.add(0)
        new_has_zero = True

    # Determine new has_zero and current_set
    current_set = new_set - {0}
    has_zero = new_has_zero or (0 in new_set)

    # Calculate the count
    count = len(current_set) + (1 if has_zero else 0)
    print(count)
0