## LCC '21 Contest 4 S4 - Art Restoration

View as PDF

Points: 15 (partial)
Time limit: 2.0s
Java 4.0s
Memory limit: 256M

Author:
Problem types

The battle has concluded! hewmatt10 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 to [REDACTED]'s torture chamber, hewmatt10 wants to remember as many contents from his art gallery as possible.

Containing paintings numbered from to each with a colourfulness , hewmatt10 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.

For this problem, all subtasks are disjoint, and you are NOT required to pass previous subtasks to earn points for a specific subtask.

1 . There will exist a solution such that . 10
2 . 15
3 . 20
4 will be unique for all queries. 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.