Logo
(追記) (追記ここまで)

27073번 - Pasture Fences 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB88453546.053%

문제

Farmer John has a long fence made of fence poles and rails. Each of the N (1 ≤ N ≤ 3000) fence poles carries a sign with a single number from -1000 through +1000. Some poles might have the same number on their sign as other poles. While chewing their cud, the cows made up a game. The cow who can find the "best fence sum" gets ice cream for dessert.

To win the game, the winning cow must find the longest contiguous set of poles whose sum has the smallest absolute value. Help them determine the winning sum.

입력

  • Line 1: One line with a single integer: N
  • Lines 2..N+1: Each line contains a pole's label. Line 2 contains the value for pole with sequence number 1, etc.

출력

A single line with three numbers:

  • the sequence number of the pole that is first to be summed,
  • the sequence number of the pole that is last to be summed, and
  • the absolute value of the sum of the labels of those poles.

If more than one sequence has the same "best fence sum" and same maximum length, report the sequence with the lowest first sequence number.

제한

예제 입력 1

6
5
10
-5
-6
2
4

예제 출력 1

4 6 0

힌트

출처

Olympiad > USA Computing Olympiad > 2002-2003 Season > USACO Winter 2002 Contest > Green 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /