atcoder#AGC062C. [AGC062C] Mex of Subset Sum
[AGC062C] Mex of Subset Sum
Score : points
Problem Statement
You are given an integer sequence of length : .
Find the smallest positive integers that satisfy the following condition.
- There is no non-empty (not necessarily contiguous) subsequence of whose elements sum to .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the smallest positive integers satisfying the conditions in ascending order, separated by spaces.
3 3
1 2 5
4 9 10
The subsequences of are , and their respective sums are . Therefore, for , there are subsequences of whose elements sum to .
On the other hand, for , there is no subsequence of whose elements sum to .
20 10
324 60 1 15 60 15 1 60 319 1 327 1 2 60 2 345 1 2 2 15
14 29 44 59 74 89 104 119 134 149