The battle has concluded! [REDACTED]'s torture chamber, wants to remember as many contents from his art gallery as possible.
has lost the brutal war and was once again, removed of all of his past artworks. Wanting to cherish the last moments of his reign before inevitably returning toContaining paintings numbered from
to
each with a colourfulness
, has recalled
snapshots of him staring at his art gallery from afar, knowing the sum
of colourfulness across all paintings between
and
, inclusive.
Your task is to take these snapshots and determine a valid solution for the colourfulness of each painting.
Input Specification
On the first line, two integers, and
.
On the next lines, three integers
,
, and
, representing an individual snapshot.
Output Specification
integers
, indicating the colourfulness of each painting. If there are multiple solutions, output any one. It is guaranteed that there will be at least one solution.
Subtasks
For this problem, all subtasks are disjoint, and you are NOT required to pass previous subtasks to earn points for a specific subtask.
Subtask | Description | Points |
---|---|---|
1 | 10 | |
2 | 15 | |
3 | 20 | |
4 | 15 | |
5 | No further constraints. | 40 |
Sample Input
10 8
1 5 5
3 4 2
7 9 3
6 9 4
1 10 10
2 10 9
3 5 3
6 6 1
Sample Output
1 1 1 1 1 1 1 1 1 1
Explanation
If you add up all of the subarrays in the snapshots, you will end up with . For example, the sum of all elements from index
to
is
, the sum of all elements from
to
is
, etc. Note that
1 1 2 0 1 1 3 0 0 1
is also one of the various valid solutions.
Comments