結果

問題 No.1286 Stone Skipping
ユーザー 👑 SPD_9X2
提出日時 2025-07-13 06:36:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 909 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 65,024 KB
最終ジャッジ日時 2025-07-13 06:37:04
合計ジャッジ時間 8,187 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 2 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

https://yukicoder.me/problems/no/1286

行ける最大距離を考えると、実は連続しているので二分探索だけで行ける説?
うーん、前後100個くらい探索したら行けそうじゃない…?

"""

def check():

    nex = 0

    for i in range(1000):
        x = i
        ret = 0
        while x:
            ret += x
            x //= 2

            if ret > nex:
                if ret != nex+1:
                    print ("error:", ret, nex)
                nex += 1

def get_max(x):
    ret = 0
    while x:
        ret += x
        x //= 2
    return ret


D = int(input())

L = 0
R = D+1

while R-L != 1:

    M = (L+R)//2

    if get_max(M) >= D:
        R = M
    else:
        L = M


import sys

for i in range(R,R+10**18):

    ret = 0
    x = i
    while x:
        ret += x
        x //= 2
        if ret == D:
            print (i)
            sys.exit()

0