포럼
문제 ICPC00334

D. Decelerating Jump

설명

An athlete is participating in a new sport that is the perfect mix of hopscotch and triple jumping. For this jury sport, \(n\) squares are laid out on the ground in a line, with equal distances between them. The first phase is the approach, where an athlete sprints towards the first square, in which they start their first jump. Then, they may jump on any number of other squares, and must finally land in the last square.

The jury has given a predetermined number of points to jumping in each square, and the score of the athlete will be the sum of the scores of all the squares they jump in, including the very first and last squares.

Due to the nature of this sport, once the athlete starts jumping, they can not accelerate anymore, and the length of consecutive jumps can never increase. Naturally, it is also impossible to reverse direction.

Given the points the jury has allocated to each square, find the maximal possible score an athlete can get on this event.

제약
입력 형식

The input consists of:
- One line with an integer \(n\) (\(2\leq n\leq 3000\)), the number of squares.
- One line with \(n\) integers \(p_1, p_2, \dots, p_n\) (\(-10^9\leq p_i\leq 10^9\)), the number of points the jury awards for jumping on each of the squares.

출력 형식

Output the maximum score that an athlete can get.

예제 1
입력
4
1 -1 1 1
출력
3
예제 2
입력
4
1 1 -1 1
출력
2
예제 3
입력
3
-1 1 -1
출력
-1
예제 4
입력
3
-1 -1 -1
출력
-2
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC BAPC 2021

평가 및 의견

D. Decelerating Jump

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

D. Decelerating Jump

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8