結果

問題 No.1228 I hate XOR Matching
ユーザー chineristACchineristAC
提出日時 2020-09-11 22:03:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,022 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 71,624 KB
最終ジャッジ日時 2023-08-27 14:36:02
合計ジャッジ時間 7,029 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,308 KB
testcase_01 AC 74 ms
71,512 KB
testcase_02 AC 74 ms
71,152 KB
testcase_03 AC 75 ms
71,332 KB
testcase_04 AC 74 ms
71,416 KB
testcase_05 AC 74 ms
71,192 KB
testcase_06 AC 74 ms
71,296 KB
testcase_07 AC 74 ms
71,304 KB
testcase_08 AC 74 ms
71,300 KB
testcase_09 AC 75 ms
71,152 KB
testcase_10 AC 74 ms
71,316 KB
testcase_11 AC 75 ms
71,380 KB
testcase_12 AC 77 ms
71,364 KB
testcase_13 AC 73 ms
71,468 KB
testcase_14 AC 74 ms
71,536 KB
testcase_15 AC 75 ms
71,312 KB
testcase_16 AC 74 ms
71,368 KB
testcase_17 AC 71 ms
71,236 KB
testcase_18 AC 72 ms
71,448 KB
testcase_19 AC 74 ms
71,236 KB
testcase_20 AC 74 ms
71,252 KB
testcase_21 AC 74 ms
71,148 KB
testcase_22 AC 76 ms
71,352 KB
testcase_23 AC 72 ms
71,092 KB
testcase_24 AC 74 ms
71,304 KB
testcase_25 AC 73 ms
71,620 KB
testcase_26 AC 73 ms
71,272 KB
testcase_27 AC 76 ms
71,140 KB
testcase_28 AC 75 ms
71,356 KB
testcase_29 AC 74 ms
71,272 KB
testcase_30 AC 75 ms
71,300 KB
testcase_31 AC 76 ms
71,328 KB
testcase_32 AC 75 ms
71,376 KB
testcase_33 AC 74 ms
71,624 KB
testcase_34 AC 76 ms
71,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K,X = map(int,input().split())

if X==0:
    if K==0:
        print("Yes")
        print(1)
        print(1)
    else:
        print("Yes")
        print(1)
        print(0)
    exit()

if K==0:
    X +=1
if X&(X-1)!=0:
    print("No")
else:
    n = X.bit_length() - 1 #自由度
    bit = bin(K).count("1")
    if bit>=5:
        res = []
        c = 0
        for i in range(20):
            if K>>i & 1:
                if c<=4:
                    res.append(1<<i)
                    c+=1
                else:
                    res[-1]+=1<<i
    else:
        used = [False]*20
        res = []
        for i in range(20):
            if K>>i & 1:
                res.append(1<<i)
                used[i] = True
        for i in range(20):
            if len(res)<5 and not used[i]:
                res.append(1<<i)
    for i in range(n):
        tmp = 0
        for j in range(5):
            if i>>j & 1:
                tmp += res[j]
        res.append(tmp)
    print("Yes")
    print(len(res))
    print(*res)
0