結果
| 問題 |
No.1808 Fullgold Alchemist
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-18 20:37:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 295 ms / 2,000 ms |
| コード長 | 653 bytes |
| コンパイル時間 | 506 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 105,728 KB |
| 最終ジャッジ日時 | 2024-10-13 20:19:30 |
| 合計ジャッジ時間 | 8,627 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
# verification-helper: PROBLEM https://yukicoder.me/problems/no/1808
def is_ok(k: int) -> bool:
check = True
cnt = 0
for i in range(n):
cnt += a[i]
if cnt >= k * (i + 1): continue
check = False
return check
def binary_search(left: int, right: int) -> int:
while right - left > 1:
mid = (left + right) // 2
if is_ok(mid):
left = mid
else:
right = mid
return left
def main():
global n, a
n, m = map(int, input().split())
a = list(map(int, input().split()))
print(binary_search(-1, 10**18) // m)
if __name__ == "__main__":
main()