QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 256 MB Toplam puan: 100

#22525. 月間支出

İstatistikler

Farmer John は驚くべき会計の達人で、農場の運営資金が尽きそうだと気づきました。今後 $N$ 日($1 \le N \le 100,000$)の毎日に必要な正確な金額($1 \le money_{i} \le 10,000$)を計算し記録しました。

FJ は「fajomonths」と呼ぶ、順に並んだちょうど $M$ 個($1 \le M \le N$)の会計期間の予算を作ります。各期間は連続する一日以上で、各日はちょうど一つの期間に属します。

支出が最大の期間の支出を最小化するよう期間を区切り、月間支出限度を決めます。

入力

行 1:空白区切りの 2 整数 $N$ と $M$。行 $2\ldots N+1$:行 $i+1$ は Farmer John が $i$ 日目に使うドル額。

出力

行 1:Farmer John が採用できる最小の月間限度。

入出力例

入力 1

7 5
100
400
300
100
500
101
400

出力 1

500

注記

初めの二日を一月、三日目と四日目を一月、最後の三日をそれぞれ一月にすれば、どの月も最大 500 ドルです。他の区切り方では必要な最小月間限度がもっと大きくなります。

問題出典:USACO 2007 年 3 月。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.