Editorial for COCI '10 Contest 5 #3 Brodovi
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.
First, let's decrease all given day indices by
Let
We repeat this procedure, ignoring the days covered by previously found ships.
When there are no more entertaining days that we must take care of, we are done and the solution is equal to the number of ships found.
Complexity is
Comments