結果

問題 No.1243 約数加算
ユーザー tamatotamato
提出日時 2020-10-02 22:31:04
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 596 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,356 KB
実行使用メモリ 855,416 KB
最終ジャッジ日時 2023-09-24 21:40:44
合計ジャッジ時間 5,847 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,592 KB
testcase_01 AC 74 ms
71,948 KB
testcase_02 AC 75 ms
71,664 KB
testcase_03 AC 78 ms
71,632 KB
testcase_04 AC 90 ms
77,160 KB
testcase_05 AC 96 ms
77,100 KB
testcase_06 AC 93 ms
76,992 KB
testcase_07 AC 92 ms
77,108 KB
testcase_08 AC 92 ms
77,112 KB
testcase_09 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    for _ in range(int(input())):
        A, B = map(int, input().split())
        NB = B.bit_length()
        i0 = NB - 1
        ans = []
        while A >> i0 & 1 == B >> i0 & 1:
            i0 -= 1
        A %= 1 << i0
        while A < (1 << i0):
            ans.append(A & -A)
            A += A & -A
        for i in range(i0-1, -1, -1):
            if A >> i & 1 != B >> i & 1:
                ans.append(1 << i)
        print(len(ans))
        print(*ans)


if __name__ == '__main__':
    main()
0