結果
| 問題 |
No.2024 Xer
|
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-09-01 14:49:39 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,699 ms / 2,000 ms |
| コード長 | 1,226 bytes |
| コンパイル時間 | 91 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 62,936 KB |
| 最終ジャッジ日時 | 2024-11-14 06:01:55 |
| 合計ジャッジ時間 | 17,244 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 47 |
ソースコード
def main():
import sys
import random
from heapq import heappop, heappush
input = sys.stdin.readline
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')
if __name__=='__main__':
main()
AEn