結果

問題 No.2393 Bit Grid Connected Component
コンテスト
ユーザー mattu34
提出日時 2023-07-28 23:08:39
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 449 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 166 ms
コンパイル使用メモリ 85,728 KB
実行使用メモリ 82,660 KB
最終ジャッジ日時 2026-04-23 07:20:40
合計ジャッジ時間 3,757 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 9 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

T = int(input())
for _ in range(T):
    X, Y = map(int, input().split())
    c = X
    i = 0
    while X >= 2 ** (i + 1):
        i += 1
    # print(X, i)
    y = 2 ** (i + 1) - X
    x = Y
    if y <= 2**x:
        print(2 ** (i + 1) - 1)
        continue
    ok = False
    for k in range(1, i):
        if y <= 2**x + 2**k and y >= 2**k:
            print(2**k - 1)
            ok = True
            break
    if ok:
        continue
    print(1)
0