Editorial for SAC '22 Code Challenge 1 P3 - That Pool


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: maxcruickshanks

Subtask 1

For each update query, loop through all cells (from the bottom to top) and move the heads down one cell (and potentially remove them if they are at the bottom).

Time Complexity: \mathcal{O}(NMQ)

Subtask 2

First, read the problem statement carefully (again) and consider the definition of blood.

Then, look at the samples and their corresponding explanations.

After that, start implementing and pray there are no implementation errors.

Time Complexity: \mathcal{O}((N + M)NMQ)

Note that the worst case is impossible to achieve.

(Also, note that this problem was set to inflict maximum damage on those weak in implementation problems; however, some people disagree.)


Comments

There are no comments at the moment.