結果

問題 No.1444 !Andd
ユーザー first_vilfirst_vil
提出日時 2021-01-21 18:36:03
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 677 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 569,876 KB
最終ジャッジ日時 2023-08-29 22:08:19
合計ジャッジ時間 25,244 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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