結果

問題 No.1443 Andd
ユーザー first_vilfirst_vil
提出日時 2021-01-23 15:50:32
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 803 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 81,212 KB
最終ジャッジ日時 2023-08-29 21:52:42
合計ジャッジ時間 9,462 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
80,032 KB
testcase_01 AC 76 ms
75,660 KB
testcase_02 AC 78 ms
75,856 KB
testcase_03 AC 387 ms
76,324 KB
testcase_04 AC 556 ms
76,484 KB
testcase_05 AC 416 ms
76,352 KB
testcase_06 AC 386 ms
76,244 KB
testcase_07 AC 568 ms
76,396 KB
testcase_08 AC 498 ms
76,008 KB
testcase_09 AC 114 ms
75,636 KB
testcase_10 AC 672 ms
76,316 KB
testcase_11 AC 608 ms
76,356 KB
testcase_12 AC 591 ms
76,404 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    kC=1<<14
    import sys
    input=sys.stdin.readline
    
    n=int(input())
    a=list(map(int,input().split()))
    now=[[False]*kC for _ in range(2)]
    dp=[[False]*kC for _ in range(2)]
    
    now[0][0]=True
    rkC=range(kC)
    ans=1
    output=[]
    for i in range(1,n+1):
        for j in rkC:
            dp[i&1][j]=False
            now[i&1][j]=False
            if now[~i&1][j]:
                dp[i&1][j&a[i-1]]=True
        for j in rkC:
            if dp[i&1][j]:
                ans+=1
                now[i&1][j]=True
        if now[~i&1][0] and dp[i&1][a[i-1]]:
            ans-=1
        
        output.append(str(ans))
        
        for j in rkC:
            if now[~i&1][j]:
                now[i&1][(j+a[i-1])&(kC-1)]=True
    print('\n'.join(output))
main()
0