結果

問題 No.2024 Xer
ユーザー lam6er
提出日時 2025-04-15 20:48:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 110,544 KB
最終ジャッジ日時 2025-04-15 20:49:07
合計ジャッジ時間 7,097 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
a = list(map(int, input().split()))

# Custom sort based on the minimum of a and a^x
a.sort(key=lambda val: min(val, val ^ x))

possible = True
for i in range(n-1):
    ai = a[i]
    ai1 = a[i+1]
    cond1 = ai < (ai1 ^ x)
    cond2 = (ai ^ x) < ai1
    if not (cond1 and cond2):
        possible = False
        break

print("Yes" if possible else "No")
0