結果

問題 No.2393 Bit Grid Connected Component
ユーザー mattu34
提出日時 2023-07-28 23:08:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 78,080 KB
最終ジャッジ日時 2024-10-06 21:08:11
合計ジャッジ時間 4,046 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 9 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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