Editorial for COCI '10 Contest 6 #2 Uspon
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.
As the task clearly states, we have to find the largest climb. Climb is defined as a strictly increasing subsequence of consecutive numbers, and its size as a difference between the last and the first number. We traverse the sequence once, keeping track of the largest climb found so far, and the starting point of the climb we are currently at. Of course, it is possible that we are currently not on any climb, if the previous point was not lower than the current one. We can mark this, for example, by setting the starting point of the current climb to .
Comments