Editorial for LCC '23 Contest 1 S3 - Oreos


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

For the first subtask, you can try splitting each of the N oreos to see if it results in a fair split.

Time Complexity: O(N)

For the second subtask, notice that splitting one oreo into two cookies and one creme results in an additional two Oreo components. Thus, the parity of N and T does not change. Performing casework on all four parities of N and T should result in the answer. Implementation is left as an exercise to the reader.

Time Complexity: O(1)


Comments

There are no comments at the moment.