Editorial for The Hu Tao Fractal
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.
Authors:
,Subtask 1
It is sufficient to check if the 3x3 grid is a Hu-Tao Fractal by checking each of the numbers in the grid.Time Complexity: O(
Subtask 2 & 3
We can utilize a recursive approach to solve the remaining subtask.Let
1. If the 3x3 grid is a Hu-Tao Fractal, we store the grid as 1.
2. If the 3x3 grid is COMPLETELY EMPTY, we store the grid as 0.
3. Otherwise, we store the grid as 2.
We then check this new grid in a similar fashion.
We continue checking the grid until we cannot find a Hu-Tao Fractal in the grid. Let
Time Complexity: O(
Comments