結果

問題 No.2672 Subset Xor Sum
ユーザー rlangevin
提出日時 2024-03-15 21:53:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 447 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 81,980 KB
実行使用メモリ 280,152 KB
最終ジャッジ日時 2024-09-30 00:55:17
合計ジャッジ時間 8,082 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 45 TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
ans = 0
for a in A:
    ans ^= a
    
if ans:
    print("No")
    exit()

if N >= 5000:
    print("Yes")
    exit()
    
M = 8192
pre = [0] * M
pre[0] = 1
for i in range(N):
    dp = [0] * M
    for v in range(M):
        dp[v] += pre[v]
        dp[v^A[i]] += pre[v]
    for v in range(N + 1):
        dp[v] = min(dp[v], 3)
    dp, pre = pre, dp
    
print("Yes") if pre[0] > 2 else print("No")
0