## Editorial for JDCC '15 Contest 3 P5 - Fireworks

Remember to use this editorial

**only**when stuck, and**not to copy-paste code from it**. Please be respectful to the problem author and editorialist.**Submitting an official solution before solving the problem yourself is a bannable offence.**Author:

##### Method 1

This is a classic difference array problem. Increase the total brightness by at and decrease it by at .

**Time Complexity:**

**Space complexity:**

##### Method 2

Since there are a maximum of seconds in a show but fireworks, we don't need such a big array that will mainly be empty. We can use coordinate compression to speed up the program and to reduce memory usage. However, both methods pass. Use a map as the difference array.

**Time Complexity:**

**Space complexity:**

## Comments