@vaibhavahuja1 You made a very silly mistake. Your output string has spaces between the digits.
For input,
1
4 12
your output is:
1 1 0 2 0 1 1 0 0 1 1 0
@vaibhavahuja1 You made a very silly mistake. Your output string has spaces between the digits.
For input,
1
4 12
your output is:
1 1 0 2 0 1 1 0 0 1 1 0
Somebody please help me. PLEASE!!
I thought of the following solution. Plz can someone tell me if it is valid and can be implemented without getting a tle:
How did you came up with this solution? How did you made all those cases separately?
you call case β8 11
β impossible - it isnβt, eg. 10000012011
You can step almost directly to the right place to split the set by calculating the triangular number closest above the partition totals. Then with only a small adjustment of one to three elements, you can get a qualifying partition without intermediate calculation.
Kudos to the test case writer for finding β4 4
β to break my first submission - the partition total is 3, which is less than 4 (my test) but not less than the highest remaining element. Dβoh.