結果

問題 No.2393 Bit Grid Connected Component
ユーザー ShirotsumeShirotsume
提出日時 2023-07-28 21:36:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2024-04-16 05:27:22
合計ジャッジ時間 2,866 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
55,168 KB
testcase_01 AC 54 ms
55,296 KB
testcase_02 AC 51 ms
55,040 KB
testcase_03 AC 50 ms
55,168 KB
testcase_04 AC 50 ms
55,296 KB
testcase_05 AC 50 ms
55,424 KB
testcase_06 AC 52 ms
55,040 KB
testcase_07 AC 52 ms
55,040 KB
testcase_08 AC 50 ms
55,168 KB
testcase_09 AC 50 ms
55,296 KB
testcase_10 AC 50 ms
55,040 KB
testcase_11 AC 51 ms
55,040 KB
testcase_12 AC 52 ms
55,552 KB
testcase_13 AC 57 ms
61,824 KB
testcase_14 AC 86 ms
73,728 KB
testcase_15 AC 87 ms
74,368 KB
testcase_16 AC 112 ms
77,312 KB
testcase_17 AC 186 ms
77,568 KB
testcase_18 AC 186 ms
77,440 KB
testcase_19 AC 169 ms
77,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

t = ii()

for _ in range(t):
    x, y = mi()

    for bit in range(y, 60):
        if 1 & (x >> bit):
            y = bit
        else:
            break
    x = 2 ** (y + 1) - 1
    ans = 0
    for bit in range(0, 60):
        if 1 & (x >> bit):
            ans += 1 << bit
    print(ans)
0