D. Max Absolute Sum
- Giới hạn thời gian
- 1,0 s
- Giới hạn bộ nhớ
- 256 MB
- Điểm
- 1một phần
- Tỉ lệ AC
- 44,9%
- Người giải
- 159
Given an array of
elements
, you can choose any subsequence of elements from
and compute its absolute sum. What is the maximum absolute sum you can obtain?
Input
- The first line contains a single integer
(
) - the number of elements in the array
.
- The second line of each test case contains
integers
(
) - the elements of the array.
Output
- Output a single integer - the maximum sum you can obtain.
Samples
Sample Input 1
5
1 -2 3 -4 5Sample Output 1
9Sample Input 2
11
-1 -1 -1 -1 -1 -1 1 1 1 1 1Sample Output 2
6Notes
In first example, you can choose subsequence , and obtain
is maximum absolute sum.
Bình luận