結果

問題 No.862 XORでX
ユーザー convexineqconvexineq
提出日時 2021-04-04 12:22:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 81,768 KB
最終ジャッジ日時 2023-08-27 09:18:31
合計ジャッジ時間 8,496 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
81,520 KB
testcase_01 AC 149 ms
81,768 KB
testcase_02 AC 129 ms
80,020 KB
testcase_03 AC 143 ms
81,224 KB
testcase_04 AC 121 ms
79,184 KB
testcase_05 AC 134 ms
80,020 KB
testcase_06 AC 155 ms
81,732 KB
testcase_07 AC 137 ms
79,972 KB
testcase_08 AC 134 ms
78,900 KB
testcase_09 AC 134 ms
79,120 KB
testcase_10 AC 135 ms
79,356 KB
testcase_11 AC 136 ms
79,340 KB
testcase_12 AC 135 ms
79,796 KB
testcase_13 AC 131 ms
79,676 KB
testcase_14 AC 130 ms
79,784 KB
testcase_15 AC 122 ms
79,372 KB
testcase_16 AC 137 ms
80,276 KB
testcase_17 AC 138 ms
80,016 KB
testcase_18 AC 139 ms
80,180 KB
testcase_19 AC 141 ms
80,376 KB
testcase_20 AC 164 ms
79,972 KB
testcase_21 AC 161 ms
79,948 KB
testcase_22 AC 155 ms
80,400 KB
testcase_23 AC 159 ms
79,944 KB
testcase_24 AC 136 ms
79,628 KB
testcase_25 AC 155 ms
79,672 KB
testcase_26 AC 161 ms
80,028 KB
testcase_27 AC 160 ms
79,992 KB
testcase_28 AC 164 ms
80,132 KB
testcase_29 AC 153 ms
79,876 KB
testcase_30 AC 162 ms
80,384 KB
testcase_31 AC 168 ms
79,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n,x = map(int, input().split())
M = 10**5+6
use = [0]*M
v = 0
for i in range(1,n+1):
    use[i] = 1
    v ^= i

free = deque(range(n+1,M))
cnt = 0
from random import randrange
while v != x:
    while True:
        i = randrange(1,M)
        if use[i]==1: break
    use[i] = 0
    free.append(i)
    v ^= i
    if 0 < v^x < M and use[v^x] == 0:
        use[v^x] = 1
        break
    w = free.popleft()
    use[w] = 1
    v ^= w

for i in range(M):
    if use[i]:
        print(i)
0