Editorial for CCC '23 S1 - Trianglane
Submitting an official solution before solving the problem yourself is a bannable offence.
To help Bocchi determine how much tape she needs, we need to do some careful counting.
For the first subtask, we can count
The same principle applies to the third subtask but we also have to look for black triangles that are adjacent but in different rows. These can only occur at even-numbered positions (assuming we start counting at zero).
It is possible to solve this problem without making the observation that you can subtract from
Regardless of which approach is taken, many solutions to the first three subtasks will be quite efficient. However, the fourth subtask is meant to ensure this by disallowing overly slow solutions. It specifically requires that not too many passes are made over either row. More formally, only a constant number of passes of each row is allowed. Solutions that miss this requirement are probably too slow because they use a built-in function within a loop which itself loops through a row of triangles.
Comments