結果
| 問題 | 
                            No.1243 約数加算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-10-03 18:42:11 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 888 bytes | 
| コンパイル時間 | 79 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-18 04:45:58 | 
| 合計ジャッジ時間 | 1,062 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 8 WA * 1 | 
ソースコード
import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
    t = int(input())
    for _ in range(t):
        a, b = map(int, input().split())
        target = 0
        for i in reversed(range(60)):
            if not(a & (1 << i)) and b & (1 << i):
                target = i
                break
        cnt = 0
        res1 = []
        for i in range(60):
            if a & (1 << target):
                break
            elif a & (1 << i):
                cnt += 1
                res1.append(1 << i)
                a += (1 << i)
        res2 = []
        for i in range(60):
            if not (a & (1 << i)) and (b & (1 << i)):
                cnt += 1
                a += (1 << i)
                res2.append(1 << i)
        res = res1 + res2[::-1]
        print(cnt)
        print(*res)
if __name__ == '__main__':
    resolve()