結果

問題 No.1443 Andd
ユーザー LyricalMaestro
提出日時 2024-10-26 18:12:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 546 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 267,508 KB
最終ジャッジ日時 2024-10-26 18:12:31
合計ジャッジ時間 17,810 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 TLE * 2 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/1443



def main():
    N = int(input())
    A = list(map(int, input().split()))

    maxa = max(A)
    k = 0
    while (1 << k) < maxa:
        k += 1

    answer = [0] * N
    a_set = {0}
    for i in range(N):
        a = A[i]

        new_a_set = set()
        for b in a_set:
            new_a_set.add(a + b)
            new_a_set.add(a & b)
        answer[i] = len(new_a_set)
        a_set = new_a_set
    
    for i in range(N):
        print(answer[i])












if __name__ == "__main__":
    main()
0