結果

問題 No.1228 I hate XOR Matching
ユーザー chielochielo
提出日時 2020-09-12 00:00:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 825 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 71,616 KB
最終ジャッジ日時 2023-08-27 23:09:28
合計ジャッジ時間 10,910 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,116 KB
testcase_01 AC 68 ms
71,320 KB
testcase_02 AC 67 ms
71,244 KB
testcase_03 AC 70 ms
71,328 KB
testcase_04 AC 67 ms
71,524 KB
testcase_05 AC 68 ms
71,496 KB
testcase_06 AC 66 ms
71,428 KB
testcase_07 AC 69 ms
71,244 KB
testcase_08 AC 69 ms
71,244 KB
testcase_09 WA -
testcase_10 AC 68 ms
71,612 KB
testcase_11 AC 69 ms
71,428 KB
testcase_12 AC 69 ms
71,128 KB
testcase_13 AC 68 ms
71,288 KB
testcase_14 AC 67 ms
71,364 KB
testcase_15 AC 68 ms
71,328 KB
testcase_16 AC 69 ms
71,292 KB
testcase_17 AC 69 ms
71,352 KB
testcase_18 AC 67 ms
71,388 KB
testcase_19 AC 70 ms
71,448 KB
testcase_20 WA -
testcase_21 AC 68 ms
71,568 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 69 ms
71,616 KB
testcase_27 WA -
testcase_28 AC 67 ms
71,548 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

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(n)]
    a += a
    print(len(a))
    print(*a)
    exit()
if n <= 0:
    print(1)
    print(k)
    exit()
d = []
c = k
while c:
    d.append(c & -c)
    c -= c & -c
if len(d) >= n:
    while len(d) > n:
        d[-2] |= d[-1]
        d.pop(-1)
    d += d
    print(len(d))
    print(*d)
else:
    a = []
    for i in range(20):
        if k & (1 << i):
            a.append(1 << i)
    for i in range(20):
        if len(a) >= n:
            break
        if ~k & (1 << i):
            a.append(1 << i)
    a += a
    print(len(a))
    print(*a)
0