Time Limit: 2s
Memory Limit: 256MB
Find the largest weight subsequence of a given sequence of numbers.
Example
The first line contains a positive integers N (1 ≤ N ≤ 106).
The second line contains N integers.
You should output on a single line an unique integer that is the maximum value of the sum of the found subsequence.
6 -2, 11, -4, 13, -5, 2
20