結果

問題 No.2393 Bit Grid Connected Component
ユーザー とろちゃとろちゃ
提出日時 2023-07-28 22:18:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-04-16 06:16:14
合計ジャッジ時間 2,651 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 41 ms
51,456 KB
testcase_02 AC 41 ms
51,840 KB
testcase_03 AC 42 ms
51,968 KB
testcase_04 AC 41 ms
51,840 KB
testcase_05 AC 43 ms
51,968 KB
testcase_06 AC 42 ms
51,712 KB
testcase_07 AC 42 ms
51,840 KB
testcase_08 AC 42 ms
52,352 KB
testcase_09 AC 42 ms
51,840 KB
testcase_10 AC 42 ms
51,968 KB
testcase_11 AC 42 ms
52,096 KB
testcase_12 WA -
testcase_13 AC 43 ms
52,096 KB
testcase_14 AC 89 ms
73,856 KB
testcase_15 AC 94 ms
76,288 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 126 ms
75,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1")
# from bisect import *
# from collections import *
# from heapq import *
# from itertools import *
# from math import *
# from datetime import *
# from decimal import *  # PyPyだと遅い
# from string import ascii_lowercase,ascii_uppercase
# import numpy as np
import sys

# sys.setrecursionlimit(10**6) # PyPyだと遅い
INF = 10**20
MOD = 998244353
# MOD = 10**9 + 7
File = sys.stdin


def input():
    return File.readline()[:-1]


# ///////////////////////////////////////////////////////////////////////////


for _ in range(int(input())):
    x, y = map(int, input().split())
    idx_y = x // (2**y) // 2 + 1
    if idx_y % 2:
        print(2 ** (y + 1) - 1)
        continue
    else:
        cnt = 0
        while idx_y % 2 == 0:
            idx_y /= 2
            cnt += 1
        print(2 ** (y + 1 + cnt) - 1)

# s = str.maketrans("10", "■_")
# for i in range(1, 101):
#     print(f"{i:020b}"[::-1].translate(s))
0