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

24564번 - Recycling 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB161554731.544%

문제

Heck S. Quincy (or Hex as his friends call him) is in charge of recycling efforts in the Quad Cities within the greater Tri-state area as well as the Twin Cities in the Lone Star State. One of the programs he oversees is the placement of large recycling bins at various locations in the cities. Transporting these bins is very expensive so he tries to keep them at any given location for as long as possible, emptying them once a week. He's willing to keep a bin at a given location as long as it is full at the end of each week.

Hex has very reliable estimates of the amount of recyclable materials (in cubic meters) that he can expect each week at each location. Given this information he would like to know when to install the recycling bin of an appropriate size to maximize the amount of material recycled. He will keep the bin at that location up to (but not including) the week when they don't expect it to be filled to capacity.

For example, suppose Hex has the following estimates for the next seven weeks: 2ドル\ 5\ 7\ 3\ 5\ 10\ 2$. Hex has several options for placing bins, including:

  • A capacity-2ドル$ bin from week 1ドル$ until week 7ドル,ドル recycling 14ドル\textrm{m}^3$
  • A capacity-5ドル$ bin from week 2ドル$ until week 3ドル,ドル recycling 10ドル\textrm{m}^3$
  • A capacity-3ドル$ bin from week 2ドル$ until week 6ドル,ドル recycling 15ドル\textrm{m}^3$ (this is the maximum possible)

Hex would not place a capacity-5ドル$ bin from week 2ドル$ until week 6ドル,ドル since it would not be filled in week 4ドル$.

입력

Input starts with a line containing a single positive integer $n$ ($n \leq 100,000円$) indicating the number of weeks which Hex has estimates for. Weeks are numbered 1ドル$ to $n$. Following this are $n$ non-negative integers listing, in order, the amount of recycling expected for each of the $n$ weeks. These values may be over multiple lines.

출력

Output three integers $s$ $e$ $r$ where $s$ and $e$ are the start and end weeks for when to place the bin to maximize the total recycling and $r$ is that maximum amount. If there are two or more time periods that lead to the same maximum amount, output the one with the smallest $s$ value.

제한

예제 입력 1

7
2 5 7 3 5
10 2

예제 출력 1

2 6 15

예제 입력 2

8
2 5 7 3 5
10 2 4

예제 출력 2

1 8 16

힌트

Ambiguous Test Case

The one ambiguous test case is here. It is not included in the zip file. The two possible answers are:

  • 1 50000 2500050000
  • 1 50001 2500050000

출처

ICPC > Regionals > North America > East Central North America Regional > 2021 East Central Regional Contest J번

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

출처

대학교 대회

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

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