結果

問題 No.1456 Range Xor
ユーザー titia
提出日時 2021-03-31 21:34:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 28,160 KB
最終ジャッジ日時 2024-12-15 15:52:06
合計ジャッジ時間 4,971 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import Counter

N,K=map(int,input().split())
A=list(map(int,input().split()))

X=[0]
for a in A:
    X.append(X[-1]^a)

Y=Counter(X[1:])

if Y[K]>=1:
    print("Yes")
    exit()

for y in Y:
    k=K^y
    if k==y:
        if Y[k]>=2:
            print("Yes")
            break
    else:
        if Y[k]>=1:
            print("Yes")
            break

else:
    print("No")
0