기출 문제 / 삼성 2024 Second Half Afternoon Problem 2

CodeTree Hiking Game

The employees of CodeTree decided to play a game to replace their plan to go hiking and see the autumn leaves. The hiking game takes place on a one-dimensional map. The map consists of a series of mountains, each with a specific height. The game proceeds under the following conditions: