結果

問題 No.1444 !Andd
ユーザー first_vilfirst_vil
提出日時 2021-01-21 18:36:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 251,272 KB
最終ジャッジ日時 2023-08-29 22:07:30
合計ジャッジ時間 20,160 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
testcase_06 WA -
testcase_07 WA -
testcase_08 TLE -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    add_dp=[[False]*1024 for _ in range(n+1)]
    and_dp=[[False]*1024 for _ in range(n+1)]
    and_dp[0][0]=True
    r1024=range(1024)
    for i in range(n):
        for j in r1024:
            if not add_dp[i][j] and not and_dp[i][j]:
                continue
            add_dp[i+1][(j+a[i])&1023]=True
            and_dp[i+1][j&a[i]]=True
    a.append(0)
    for i in range(n-1,-1,-1):
        a[i]+=a[i+1]
        
    ans={}
    for i in range(n+1):
        for k in r1024:
            if and_dp[i][k]:
                ans[k+a[i]]=0
    print(len(ans))
main()
0