Mock CCC '26 S4 - Swing
View as PDFMock Canadian Computing Competition: 2026 Senior #4
Swing is the brand new mobile game that challenges people to swing across platforms. The prize? Currency! Everyone knows that the best mobile games always come with micro-transactions. However, as the free-to-play player he is, he loves to maximize his rewards.
This time, has won big! His winnings are pieces of currency, in possible denominations worth
moon dollars. However, it's never that easy to collect all of that prize money: can only use at most
bags to fit his winnings, each of which can contain at most a total value of
moon dollar. For example, a bag could fit a piece worth
a moon dollar and another piece worth
a moon dollar for a sum of
moon dollars.
However, he knows that the pieces of currency can be distributed into these bags since he sees there is at most a total of
moon dollars lying on the ground (which he mathematically proved)! After spending all this time proving this fact, he's exhausted and wants your help to determine any valid way to distribute his earnings into the bags for him.
Input Specification
The first line will contain two space-separated integers , representing the number of bags has, and the number of pieces of currency lying on the ground, respectively.
The second line will contain space-separated integers
, representing the
pieces of currency he sees, where each piece is worth
.
The following table shows how the available 15 marks are distributed. Subtasks do not have to be completed in order and you do not need to solve the sample cases to be graded for each subtask.
| Marks | Bounds on |
Bounds on |
Additional Constraints |
|---|---|---|---|
| None | |||
| Each | |||
| None |
Note that knows that , and it is always possible to come up with a valid construction.
Output Specification
The first line of output must contain an integer , representing the number of bags being used to collect the currency. Note that the value of
does not have to be optimal.
The next lines of output must begin with a positive integer
, representing the number of pieces of currency in the bag. On the same line, there should be
space separated integers
, denoting the pieces of currency in the bag.
For each case, if any bag does not satisfy , or not all the currency is collected, or there is extra currency being collected not specified by the problem input, you will receive a WA verdict. Otherwise, you will receive an AC verdict.
Keep in mind that the judge is very strict. Ensure that you have no trailing whitespace in your output and each line must end with a newline character '\n'.
For example, the lines '3 10 10 10\n' and '3 10 10 10 \n' and '3 10 10 10' are very different; only the first is acceptable.
Sample Input 1
3 3
1 4 2
Possible Output for Sample Input 1
3
1 1
1 2
1 4
Explanation of Output for Sample Input 1
can use all bags, each containing a singular currency, with each totalling a value of
moon dollars, respectively. Note that this is not the only valid option, and you do not need to use all
bags. Keep in mind that
3
1 1
0
2 2 4
is not valid.
Sample Input 2
3 7
5 4 7 4 1 10 3
Possible Output for Sample Input 2
3
1 1
3 5 7 10
3 4 3 4
Explanation of Output for Sample Input 2
The first bag has moon dollar, the second bag has
moon dollars, and the third bag has
moon dollars.
Comments