結果
問題 |
No.2024 Xer
|
ユーザー |
![]() |
提出日時 | 2022-09-01 14:34:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 962 bytes |
コンパイル時間 | 465 ms |
コンパイル使用メモリ | 82,368 KB |
実行使用メモリ | 171,428 KB |
最終ジャッジ日時 | 2024-11-14 05:50:39 |
合計ジャッジ時間 | 25,138 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 44 TLE * 3 |
ソースコード
from heapq import heappop, heappush N, X = map(int, input().split()) A = list(map(int, input().split())) h = [] for i in range(N): heappush(h, (A[i], 0, i)) heappush(h, (A[i]^X, 1, i)) res1, res2 = [], [] for i in range(2*N): n, w, idx = heappop(h) l1, l2 = len(res1), len(res2) w1, w2 = (l1+1)%2, l2%2 if w1==w2: if w1!=w: exit(print('No')) else: if l1>l2: if res1[l2] == idx: res2.append(idx) else: res1.append(idx) else: if res2[l1] == idx: res1.append(idx) else: res2.append(idx) else: if w1 == w: res1.append(idx) else: res2.append(idx) if len(res1) != len(res2): exit(print("No")) else: for i in range(N): if res1[i] != res2[i]: exit(print("No")) print('Yes')