Editorial for SAC '22 Code Challenge 5 P5 - Querying Rectangles
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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
It suffices to construct a string for every subgrid, store it in a set, and then output that size.
Time Complexity:
Subtask 2
Realize that 2D hashing is possible, maintain a rolling hash for each subgrid, and insert that into a set to output the final size.
Time Complexity:
Comments