atcoder#AGC020C. [AGC020C] Median Sum
[AGC020C] Median Sum
Score : points
Problem Statement
You are given integers , , ..., .
Consider the sums of all non-empty subsequences of . There are such sums, an odd number.
Let the list of these sums in non-decreasing order be , , ..., .
Find the median of this list, .
Constraints
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the median of the sorted list of the sums of all non-empty subsequences of .
3
1 2 1
2
In this case, . Its median is .
1
58
58
In this case, .