Time Limit: 2 sec / Memory Limit: 1024 MB
NNH_1H1\ldots…H_NHN
5
1 5 10 4 2
10
Takahashi is initially standing on the leftmost platform, whose height is 11. The next platform to the right has a height of 55 and is higher than the current platform, so he steps onto it.
He is now standing on the 22-nd platform from the left, whose height is 55. The next platform to the right has a height of 1010 and is higher than the current platform, so he steps onto it.
He is now standing on the 33-rd platform from the left, whose height is 1010. The next platform to the right has a height of 44 and is lower than the current platform, so he stops moving.
Thus, the height of the final platform Takahashi will stand on is 1010.