Maximum Subsequence
Time limit2sMemory limit1024 MB
Permute a sequence of up to 16 integers so that its maximum contiguous subarray sum is as small as possible, and print that minimum.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Bit manipulation, Greedy, Sorting
- Solved
- No attempts yet
Problem
For a sequence , define as
Given a sequence , you need to permute to obtain and minimize .
Input
The first line contains a single integer ().
The second line contains integers ().
Output
Output the minimum possible value of .