結果

問題 No.2672 Subset Xor Sum
ユーザー H20
提出日時 2024-03-16 01:00:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 146,896 KB
最終ジャッジ日時 2024-09-30 04:26:54
合計ジャッジ時間 6,127 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 66
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N = int(input())
A = list(map(int, input().split())) 
xor = 0
for a in A:
    xor^=a
if xor>0:
    print('No')
    exit()
S = set()
for a in A[:N-1]:
    NS = set()
    NS.add(a)
    for s in S:
        NS.add(s^a)
    MS = NS | S
    if len(MS) != len(NS)+len(S):
        print('Yes')
        exit()
    S = MS
print('No')

0