結果

問題 No.1456 Range Xor
ユーザー Tna
提出日時 2022-07-15 11:56:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 636 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,012 KB
最終ジャッジ日時 2024-06-27 06:29:21
合計ジャッジ時間 4,723 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from functools import reduce
from itertools import combinations


def cal_xor(a, b):
    return a ^ b


n, k = [int(x) for x in input().split()]
data = [int(x) for x in input().split()]

for i in range(1, n+1):
    for j in range(i, n+1):
        if i == j:
            # print(i, j, data[i-1])
            pass
        # elif i == n+1 or j == n+1:
        #     print(i, j, data[i:j])
        else:
            # print(i, j, data[i-1:j-1])
            if reduce(cal_xor, data[i-1:j-1]) == k:
                print("Yes")
                sys.exit()
        # for v in combinations()
# print(reduce(cal_xor, data))
print("No")
0