結果
| 問題 |
No.1286 Stone Skipping
|
| コンテスト | |
| ユーザー |
ygd.
|
| 提出日時 | 2020-11-13 21:50:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 722 bytes |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 82,256 KB |
| 最終ジャッジ日時 | 2024-07-22 20:43:00 |
| 合計ジャッジ時間 | 5,162 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 1 -- * 5 |
ソースコード
D = int(input())
ok = pow(10,18)*2
ng = 0
def check(x):
ret = x
while x > 0:
x = x//2
ret += x
return ret
cnt = 0
while abs(ok-ng) > 1: #and cnt < 100:
mid = (ok+ng)//2
#print(ok,mid,ng)
if check(mid) >= D:
ok = mid
else:
ng = mid
cnt += 1
ans = ok
#print(ans)
def verify(x,y):
ret = x
while x > 0:
if ret == y:
return True
else:
x = x//2
ret += x
if ret == y:
return True
else:
return False
a = ans + 0
b = ans - 0
while True:
if verify(a,D):
print(a)
break
elif verify(b,D):
print(b)
break
else:
a += 1
b -= 1
ygd.