結果

問題 No.2393 Bit Grid Connected Component
ユーザー lloyzlloyz
提出日時 2023-07-28 21:37:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-10-06 17:59:25
合計ジャッジ時間 2,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

Pow2 = [pow(2, i) for i in range(60)]

for _ in range(int(input())):
    x, y = map(int, input().split())
    B = [0 for _ in range(60)]
    xc = x
    for i in range(60):
        xc, r = divmod(xc, 2)
        B[i] = r
    r = y
    while r < 59 and B[r + 1] == 1:
        r += 1
    ans = 0
    for i in range(r + 1):
        ans += Pow2[i]
    print(ans)
0