Read t up to 1e18 and print k = 300 with sixty 1s plus extra elements chosen by greedy binomial decomposition so exactly t subsets sum to 300.
Easy3CombinatoricsImplementationNo attempts yetTime limit1sMemory limit32 MBMaking test data is a large part of setting a problem. There is no fixed recipe for it. For each problem you list the wrong answers that solvers are likely to write, then prepare data that catches them.
Consider the following problem.
A multiset S={a1,a2,…,an} is given. How many subsets of S have element sum exactly k? Two elements with the same value but different positions count as different.
The constraints are 1≤n≤300 and 1≤k≤300, and every element of S is a natural number no greater than k.
One wrong answer for it prints t−1 on data whose true answer is t. To catch that answer you need a program that takes a natural number t and produces a multiset S and a natural number k whose answer is exactly t. Write that program.
Many data sets satisfy the condition, so only the one built by the method given in the output section is accepted.
The first line contains a natural number t. (1≤t≤1018)
On the first line print n and k, separated by a space. On the second line print a1,a2,…,an in nondecreasing order, separated by spaces. n, k and S must satisfy the constraints above.
Build the data by this method only.
Each element added in step 3 lies in exactly (d60) subsets of sum 300, and every subset of sum 300 contains exactly one element added in step 3. The answer for this data is therefore exactly t. For t≤1018 the value of n never exceeds 242.