atcoder#CODEFESTIVAL2016FINALB. Exactly N points
Exactly N points
Score : points
Problem Statement
The problem set at CODE FESTIVAL 20XX Finals consists of problems.
The score allocated to the -th problem is points.
Takahashi, a contestant, is trying to score exactly points. For that, he is deciding which problems to solve.
As problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.
Determine the set of problems that should be solved.
Constraints
Partial Score
- points will be awarded for passing the test set satisfying .
- Additional points will be awarded for passing the test set without additional constraints.
Input
The input is given from Standard Input in the following format:
Output
Among the sets of problems with the total score of , find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.
If there exists more than one such set, any of them will be accepted.
4
1
3
Solving only the -th problem will also result in the total score of points, but solving the -st and -rd problems will lower the highest score of a solved problem.
7
1
2
4
The set will also be accepted.
1
1