結果
| 問題 |
No.2217 Suffix+
|
| コンテスト | |
| ユーザー |
kohakoha11301
|
| 提出日時 | 2023-02-26 17:32:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 403 ms / 2,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 92,672 KB |
| 最終ジャッジ日時 | 2024-09-14 07:26:02 |
| 合計ジャッジ時間 | 6,879 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
import math
def judge(mid):
cnt = 0
nokori = k
for i in range(n):
if mid > a[i] + cnt:
# print(cnt,(mid - a[i] - cnt))
nokori -= math.ceil((mid - a[i] - cnt) / (i + 1))
cnt += (i + 1) * math.ceil((mid - a[i] - cnt) / (i + 1))
if nokori < 0:
return False
else:
return True
n, k = map(int, input().split())
a = list(map(int, input().split()))
ok = 0
ng = 10 ** 18
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if judge(mid):
ok = mid
else:
ng = mid
print(ok)
kohakoha11301