Editorial for Cheerio Contest 3 P1 - Wet Floor


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

For this question, it suffices to do a linear scan over the string(s).

Subtask 1 For each cell, we add cones to its adjacent (left and right) cells if the cell contains water and its adjacent (left and right) cells do not.
Time Complexity: \mathcal{O}(M)
Subtask 2 The same logic as subtask 1, except we also check the cells above and below the current cell.
Time Complexity: \mathcal{O}(NM)

Comments

There are no comments at the moment.