Editorial for Wesley's Anger Contest 6 Problem 2 - Cheap Christmas Lights
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
First, we note that toggle operations are commutative so Wesley has the ability to "accumulate" switch usages, such that instead of using one switch per second for the first
Subtask 1
For the first subtask, we keep track of the state of each light throughout the first
Time Complexity:
Subtask 2
Instead of iterating through the array storing lights' states, we can use a counter to keep track of how many lights are on at any given moment. We no longer need to recount the number of lights turned on at every iteration.
Time Complexity:
Comments