Editorial for Champion Contest
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:
There are several ways to approach this problem. I will be explaining one of them.
Since
The solution is to sort the array, and binary search for the farthest indexed champion which the current champion can defeat. This is an
We can precompute an array of
Time Complexity:
Comments