結果
| 問題 |
No.2393 Bit Grid Connected Component
|
| コンテスト | |
| ユーザー |
mattu34
|
| 提出日時 | 2023-07-28 22:57:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 440 bytes |
| コンパイル時間 | 176 ms |
| コンパイル使用メモリ | 82,172 KB |
| 実行使用メモリ | 77,628 KB |
| 最終ジャッジ日時 | 2024-10-06 20:46:31 |
| 合計ジャッジ時間 | 3,823 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 9 WA * 11 |
ソースコード
T = int(input())
for _ in range(T):
X, Y = map(int, input().split())
c = X
i = -1
while c:
c //= 2
i += 1
y = 2 ** (i + 1) - X - 1
x = Y
if y <= 2**x:
print(2 ** (i + 1) - 1)
continue
ok = False
for k in range(1, i + 1):
if y <= 2**x + 2**k and y >= 2**k:
print(2**k - 1)
ok = True
break
if ok:
continue
print(1)
mattu34