結果

問題 No.2024 Xer
ユーザー AEnAEn
提出日時 2022-09-01 14:46:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,896 ms / 2,000 ms
コード長 1,226 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 81,964 KB
実行使用メモリ 170,048 KB
最終ジャッジ日時 2024-04-26 16:41:34
合計ジャッジ時間 20,621 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,528 KB
testcase_01 AC 46 ms
54,528 KB
testcase_02 AC 44 ms
54,656 KB
testcase_03 AC 46 ms
54,784 KB
testcase_04 AC 41 ms
54,784 KB
testcase_05 AC 42 ms
54,784 KB
testcase_06 AC 41 ms
54,272 KB
testcase_07 AC 1,896 ms
155,884 KB
testcase_08 AC 1,562 ms
170,048 KB
testcase_09 AC 341 ms
134,476 KB
testcase_10 AC 1,588 ms
169,944 KB
testcase_11 AC 563 ms
96,668 KB
testcase_12 AC 934 ms
114,456 KB
testcase_13 AC 1,075 ms
120,368 KB
testcase_14 AC 1,779 ms
163,172 KB
testcase_15 AC 725 ms
105,412 KB
testcase_16 AC 1,224 ms
125,380 KB
testcase_17 AC 166 ms
94,400 KB
testcase_18 AC 615 ms
102,760 KB
testcase_19 AC 1,822 ms
163,156 KB
testcase_20 AC 223 ms
105,052 KB
testcase_21 AC 339 ms
134,876 KB
testcase_22 AC 336 ms
134,704 KB
testcase_23 AC 348 ms
134,964 KB
testcase_24 AC 345 ms
134,388 KB
testcase_25 AC 54 ms
65,308 KB
testcase_26 AC 72 ms
74,784 KB
testcase_27 AC 119 ms
78,548 KB
testcase_28 AC 69 ms
70,756 KB
testcase_29 AC 60 ms
69,716 KB
testcase_30 AC 81 ms
77,476 KB
testcase_31 AC 80 ms
77,272 KB
testcase_32 AC 135 ms
78,492 KB
testcase_33 AC 73 ms
74,464 KB
testcase_34 AC 52 ms
63,448 KB
testcase_35 AC 43 ms
55,392 KB
testcase_36 AC 73 ms
74,984 KB
testcase_37 AC 78 ms
77,464 KB
testcase_38 AC 80 ms
77,444 KB
testcase_39 AC 54 ms
63,172 KB
testcase_40 AC 67 ms
69,684 KB
testcase_41 AC 121 ms
78,264 KB
testcase_42 AC 80 ms
77,748 KB
testcase_43 AC 125 ms
78,296 KB
testcase_44 AC 130 ms
78,700 KB
testcase_45 AC 289 ms
116,936 KB
testcase_46 AC 114 ms
84,072 KB
testcase_47 AC 226 ms
104,576 KB
testcase_48 AC 43 ms
56,084 KB
testcase_49 AC 42 ms
56,352 KB
testcase_50 AC 43 ms
55,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0