結果

問題 No.2672 Subset Xor Sum
ユーザー NP
提出日時 2024-03-15 22:51:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 142,176 KB
最終ジャッジ日時 2024-09-30 02:23:23
合計ジャッジ時間 5,933 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 47 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    
    xor_all = 0
    for a in A:
        xor_all ^= a
    
    if xor_all != 0:
        print("No")
        return

    xor_cum = 0
    cnt = 0
    for a in A:
        xor_cum ^= a
        if xor_cum == xor_all:
            xor_cum = 0
            cnt += 1
    
    if cnt >= 3:
        print("Yes")
    else:
        print("No")

solve()

0