結果
| 問題 | No.1211 円環はお断り |
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 18:36:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 580 bytes |
| 記録 | |
| コンパイル時間 | 168 ms |
| コンパイル使用メモリ | 82,604 KB |
| 実行使用メモリ | 90,772 KB |
| 最終ジャッジ日時 | 2025-06-12 18:36:24 |
| 合計ジャッジ時間 | 4,182 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 WA * 5 |
ソースコード
n, k = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)
def is_possible(x):
if total < x * k:
return False
current_sum = 0
count = 0
for num in a:
current_sum += num
if current_sum >= x:
count += 1
current_sum = 0
if count >= k:
return True
return False
low = 0
high = total // k
answer = 0
while low <= high:
mid = (low + high) // 2
if is_possible(mid):
answer = mid
low = mid + 1
else:
high = mid - 1
print(answer)
gew1fw