結果
| 問題 |
No.1286 Stone Skipping
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-13 21:42:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 704 bytes |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 65,152 KB |
| 最終ジャッジ日時 | 2024-07-22 20:35:11 |
| 合計ジャッジ時間 | 2,893 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 15 WA * 10 RE * 1 |
ソースコード
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
d = int(input())
ans = d
def sub(x, k):
v = 0
i = 0
for i in range(k):
v += x
x //= 2
return v>=d
def val(x, k):
v = 0
i = 0
for i in range(k):
v += x
x //= 2
return v
def proc(k):
l = 0
r = d
while l<r-1:
m = (l+r)//2
if sub(m,k):
r = m
else:
l = m
if val(r,k)==d:
return m
else:
return None
for v in range(1,100):
tmp = proc(v)
# print(tmp)
if tmp is not None:
ans = min(ans, tmp)
print(ans)