QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22767. 牧場の柵

Statistics

Farmer John の長い柵は柱と横木です。$N$($1 \le N \le 3000$)柱に $-1000$ から $+1000$ の数の札があり、同じ数もあります。牛は反芻中ゲームを考え、「最良の柵の和」を見つけるとデザートにアイスを貰います。

和の絶対値が最小の連続柱列の中で最長を探します。勝つ和を求めてください。

入力

  • 1 行目:整数 $N$。

  • $2..N+1$ 行目:各柱の札、2 行目が番号 1 など。

出力

一行に三数:

  • 最初の柱番号、

  • 最後の柱番号、

  • 札の和の絶対値。最良の和と最大長が等しい列が複数なら開始番号最小。

入出力例

入力 1

6
5
10
-5
-6
2
4

出力 1

4 6 0

作者:Dominic Battre、2001

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.