結果

問題 No.2672 Subset Xor Sum
ユーザー NP
提出日時 2024-03-15 22:03:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 138,988 KB
最終ジャッジ日時 2024-09-30 01:16:27
合計ジャッジ時間 5,865 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 2 WA * 6 RE * 21 TLE * 1 -- * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    MAX = 5000
    dp = [0] * (MAX + 1)
    dp[0] = 1
    xor_all = 0
    for a in A:
        xor_all ^= a
        for i in range(MAX, -1, -1):
            if dp[i]:
                dp[i ^ a] = 1
    if xor_all == 0 or dp[xor_all]:
        print('Yes')
    else:
        print('No')

solve()
0