Type: Default 1000ms 256MiB

连续和最大

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

给定一个整数序列a1、a2…an,求这个序列中的一个连续子序列,使得这个序列中的数的和最大。

Input Format

第一行,一个整数n。

第二行,n个整数,a1、a2...an。

Output Format

一行,一个整数,表示你所求的最大的和。

8
3 -6 -8 4 7 -5 5 2
13

Hint

数据范围:N<=500000,序列中所有数的绝对值均不超过1000。

测试

Not Attended
Status
Done
Rule
XCPC
Problem
9
Start at
2025-9-23 14:00
End at
2025-9-23 17:00
Duration
3 hour(s)
Host
Partic.
2