This content is archived!

For the 2018-2019 school year, we have switched to using the WLMOJ judge for all MCPT related content. This is an archive of our old website and will not be updated.

Method 1

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

Time complexity

\mathcal{O}(N)

Space complexity

\mathcal{O}(N)


Method 2

Since there are a maximum of 10^7 seconds in a show but 10^4 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

\mathcal{O}(M\log M)

Space complexity

\mathcal{O}(M)


Problem

Read the problem.