結果

問題 No.1443 Andd
ユーザー gew1fw
提出日時 2025-06-12 13:26:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 694 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 302,760 KB
最終ジャッジ日時 2025-06-12 13:32:12
合計ジャッジ時間 5,648 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    N = int(input[0])
    A = list(map(int, input[1:N+1]))
    
    current = {(0, 0)}  # (y, c) where X = y + c * 1024
    
    for a in A:
        next_set = set()
        for (y, c) in current:
            # Apply AND operation
            new_y_and = y & a
            next_set.add((new_y_and, 0))
            
            # Apply addition
            total = y + a
            new_y_add = total % 1024
            carry = total // 1024
            new_c_add = c + carry
            next_set.add((new_y_add, new_c_add))
        
        current = next_set
        print(len(current))
    
if __name__ == '__main__':
    main()
0