結果

問題 No.1228 I hate XOR Matching
ユーザー chielochielo
提出日時 2020-09-12 00:15:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 71,392 KB
最終ジャッジ日時 2023-08-28 09:01:56
合計ジャッジ時間 6,918 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,320 KB
testcase_01 AC 71 ms
71,084 KB
testcase_02 AC 72 ms
71,184 KB
testcase_03 AC 74 ms
71,076 KB
testcase_04 AC 71 ms
71,164 KB
testcase_05 AC 73 ms
71,208 KB
testcase_06 AC 72 ms
71,320 KB
testcase_07 AC 71 ms
71,284 KB
testcase_08 AC 73 ms
71,204 KB
testcase_09 AC 70 ms
71,316 KB
testcase_10 AC 70 ms
71,084 KB
testcase_11 AC 71 ms
71,032 KB
testcase_12 AC 71 ms
71,204 KB
testcase_13 AC 69 ms
70,852 KB
testcase_14 AC 69 ms
71,392 KB
testcase_15 AC 73 ms
71,288 KB
testcase_16 AC 72 ms
71,084 KB
testcase_17 AC 72 ms
71,064 KB
testcase_18 AC 71 ms
71,088 KB
testcase_19 AC 72 ms
71,392 KB
testcase_20 AC 72 ms
71,288 KB
testcase_21 AC 71 ms
71,212 KB
testcase_22 AC 74 ms
71,084 KB
testcase_23 AC 72 ms
70,856 KB
testcase_24 AC 72 ms
71,392 KB
testcase_25 AC 72 ms
71,104 KB
testcase_26 AC 72 ms
71,384 KB
testcase_27 AC 73 ms
71,068 KB
testcase_28 AC 73 ms
71,324 KB
testcase_29 AC 74 ms
71,072 KB
testcase_30 AC 78 ms
71,200 KB
testcase_31 AC 76 ms
71,192 KB
testcase_32 AC 71 ms
71,024 KB
testcase_33 AC 72 ms
71,208 KB
testcase_34 AC 71 ms
71,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k, x = map(int, input().split())
if x == 0:
    print('Yes')
    print(1)
    print(k - 1 if k >= 1 else k + 1)
    exit()
if k == 0:
    x += 1
if (x & -x) != x:
    print('No')
    exit()
print('Yes')
n = 0
while 2 ** n < x:
    n += 1
if k == 0:
    a = [2 ** i for i in range(9)]
    a += list(range(1, n + 1))
    print(len(a))
    print(*a)
    exit()
if n <= 0:
    print(1)
    print(k)
    exit()
a = []
for i in range(9):
    if (1 << i) != (k & -k):
        a.append(1 << i)
    else:
        a.append(k)
if k not in a:
    a.append(k)
b = []
for i in range(1, n + 1):
    c = 0
    for j in range(len(a)):
        if i & (1 << j):
            c ^= a[j]
    b.append(c)
a += b
print(len(a))
print(*a)
0