結果

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

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    idx = 0
    N = int(input[idx])
    idx += 1
    A = list(map(int, input[idx:idx+N]))
    
    current_set = set()
    current_set.add(1)
    output = []
    zero_included = False
    
    for a in A:
        if zero_included:
            output.append(1)
            continue
        
        if a == 0:
            current_set = {0}
            zero_included = True
            output.append(1)
        else:
            new_set = set()
            for x in current_set:
                mult = x * a
                new_set.add(mult)
                and_val = x & a
                new_set.add(and_val)
            current_set = new_set
            output.append(len(current_set))
    
    print('\n'.join(map(str, output)))

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