13322 - Greatest Consecutive Sum
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
Description
Given a series of numbers, a1, a2, a3, ..., an.
With these numbers, we want to know which is the greatest consecutive sum.
A consecutive sum(L,R) is the sum of aL, aL+1, aL+2, ..., aR.
How to estimate the running time of your code?
A usual computer can run 109 basic operations (such as +, -, &, |) in 1 second. Althought this depends on the judging server, this number serves as a good estimation for the running time of your code. Try to figure out how much operations your code needs to execute to finish all the computations (since not all operations in your code are basic operations, another estimate criterion is 108 operations (+, -, *, /, =, ...) in 1 second)!
Input
First line is a integer N, representing there're N integers.
Next, N integers are provided a1, a2, a3, ..., an.
0 < N <= 2*105
0 <= |ai| <= 1000
Output
Output the greatest consecutive sum.
Tags