結果

問題 No.2672 Subset Xor Sum
コンテスト
ユーザー NP
提出日時 2024-03-15 22:51:58
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 434 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 331 ms
コンパイル使用メモリ 85,020 KB
実行使用メモリ 140,520 KB
最終ジャッジ日時 2026-04-16 08:23:27
合計ジャッジ時間 4,606 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 47 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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