結果
| 問題 |
No.2217 Suffix+
|
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2023-02-17 21:57:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 185 ms / 2,000 ms |
| コード長 | 479 bytes |
| コンパイル時間 | 223 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 91,904 KB |
| 最終ジャッジ日時 | 2024-07-19 13:09:52 |
| 合計ジャッジ時間 | 4,498 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
def is_ok(V):
cnt = 0
add = 0
for i,a in enumerate(A,start=1):
if add+a<V:
temp = -(-(V-a-add)//i)
add+=temp*i
cnt+=temp
return cnt<=K
def meguru_bisect(ng, ok):
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if is_ok(mid):
ok = mid
else:
ng = mid
return ok
N,K = map(int, input().split())
A = list(map(int, input().split()))
print(meguru_bisect(10**18,0))
H20