結果

問題 No.1456 Range Xor
コンテスト
ユーザー Tna
提出日時 2022-07-15 11:56:22
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 636 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 996 ms
コンパイル使用メモリ 20,760 KB
実行使用メモリ 40,408 KB
最終ジャッジ日時 2026-03-14 16:00:33
合計ジャッジ時間 123,336 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 3 TLE * 40
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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