結果

問題 No.2024 Xer
ユーザー AEnAEn
提出日時 2022-09-01 14:49:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,698 ms / 2,000 ms
コード長 1,226 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 62,816 KB
最終ジャッジ日時 2024-04-26 16:43:48
合計ジャッジ時間 17,261 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
11,136 KB
testcase_01 AC 34 ms
11,008 KB
testcase_02 AC 34 ms
11,008 KB
testcase_03 AC 35 ms
11,136 KB
testcase_04 AC 36 ms
11,136 KB
testcase_05 AC 34 ms
11,264 KB
testcase_06 AC 35 ms
11,136 KB
testcase_07 AC 1,698 ms
62,816 KB
testcase_08 AC 1,151 ms
62,536 KB
testcase_09 AC 314 ms
62,108 KB
testcase_10 AC 1,154 ms
62,492 KB
testcase_11 AC 425 ms
27,252 KB
testcase_12 AC 795 ms
38,864 KB
testcase_13 AC 893 ms
42,132 KB
testcase_14 AC 1,602 ms
59,632 KB
testcase_15 AC 590 ms
32,744 KB
testcase_16 AC 1,037 ms
45,524 KB
testcase_17 AC 147 ms
29,884 KB
testcase_18 AC 532 ms
30,124 KB
testcase_19 AC 1,578 ms
60,164 KB
testcase_20 AC 202 ms
41,060 KB
testcase_21 AC 327 ms
62,080 KB
testcase_22 AC 331 ms
61,900 KB
testcase_23 AC 327 ms
62,028 KB
testcase_24 AC 331 ms
61,984 KB
testcase_25 AC 36 ms
11,520 KB
testcase_26 AC 39 ms
12,160 KB
testcase_27 AC 43 ms
11,648 KB
testcase_28 AC 37 ms
11,392 KB
testcase_29 AC 36 ms
11,520 KB
testcase_30 AC 39 ms
12,032 KB
testcase_31 AC 40 ms
12,416 KB
testcase_32 AC 52 ms
12,288 KB
testcase_33 AC 38 ms
12,032 KB
testcase_34 AC 36 ms
11,392 KB
testcase_35 AC 34 ms
11,136 KB
testcase_36 AC 37 ms
11,904 KB
testcase_37 AC 40 ms
12,288 KB
testcase_38 AC 41 ms
12,416 KB
testcase_39 AC 35 ms
11,264 KB
testcase_40 AC 36 ms
11,264 KB
testcase_41 AC 43 ms
11,776 KB
testcase_42 AC 39 ms
11,904 KB
testcase_43 AC 44 ms
11,776 KB
testcase_44 AC 48 ms
12,032 KB
testcase_45 AC 261 ms
50,728 KB
testcase_46 AC 80 ms
19,716 KB
testcase_47 AC 210 ms
41,792 KB
testcase_48 AC 34 ms
11,136 KB
testcase_49 AC 33 ms
11,136 KB
testcase_50 AC 33 ms
11,008 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