結果

問題 No.1228 I hate XOR Matching
ユーザー chineristACchineristAC
提出日時 2020-09-11 22:02:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 868 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 86,848 KB
実行使用メモリ 71,592 KB
最終ジャッジ日時 2023-08-27 14:33:26
合計ジャッジ時間 7,131 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,568 KB
testcase_01 AC 73 ms
71,464 KB
testcase_02 AC 73 ms
71,348 KB
testcase_03 AC 72 ms
71,428 KB
testcase_04 AC 72 ms
71,592 KB
testcase_05 AC 72 ms
71,272 KB
testcase_06 WA -
testcase_07 AC 73 ms
71,328 KB
testcase_08 AC 72 ms
71,292 KB
testcase_09 AC 73 ms
71,380 KB
testcase_10 AC 73 ms
71,328 KB
testcase_11 AC 73 ms
71,568 KB
testcase_12 AC 74 ms
71,252 KB
testcase_13 AC 72 ms
71,160 KB
testcase_14 AC 74 ms
71,312 KB
testcase_15 AC 73 ms
71,576 KB
testcase_16 AC 73 ms
71,536 KB
testcase_17 AC 73 ms
71,304 KB
testcase_18 AC 73 ms
71,264 KB
testcase_19 AC 73 ms
71,404 KB
testcase_20 AC 72 ms
71,232 KB
testcase_21 AC 73 ms
71,300 KB
testcase_22 AC 71 ms
71,312 KB
testcase_23 AC 72 ms
71,432 KB
testcase_24 AC 73 ms
71,352 KB
testcase_25 AC 73 ms
71,276 KB
testcase_26 AC 74 ms
71,396 KB
testcase_27 AC 72 ms
71,288 KB
testcase_28 AC 73 ms
71,356 KB
testcase_29 AC 73 ms
71,328 KB
testcase_30 AC 73 ms
71,384 KB
testcase_31 AC 73 ms
71,312 KB
testcase_32 AC 74 ms
71,324 KB
testcase_33 AC 73 ms
71,356 KB
testcase_34 AC 73 ms
71,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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