eolymp
bolt
Try our new interface for solving problems

Ropes

When climbing a section or "pitch", the lead climber ascends first, taking a rope with them that they anchor to the rock for protection to ascend. Once at the top of a pitch, the lead climber has the second climber attach to the rope, so they can ascend with the safety of the rope. Once the second climber reaches the top of the pitch, the third attaches, and so on until all the climbers have ascended. For example, for a \textbf{10} meter pitch and \textbf{50} meter rope, at most \textbf{6} climbers could ascend, with the last climber attaching to the end of the rope. To ascend safely, there must be at least \textbf{2} climbers and the rope must be at least as long as the pitch. This process is repeated on each pitch of the climb, until the top is reached. Then to descend, the climbing rope is hung at its midpoint from an anchor (each half must reach the ground). The climbers then each rappel from this rope. The rope is retrieved from the anchor by pulling one side of the rope, slipping it though the anchor and allowing it to fall to the ground. To descend safely, the rope must be at least twice as long as the sum of the lengths of the pitches. For example, a \textbf{60} meter rope is required to rappel from a \textbf{30} meter climb, no matter how many climbers are involved. Climbing ropes come in \textbf{50}, \textbf{60} and \textbf{70} meter lengths. It is best to take the shortest rope needed for a given climb because this saves weight. You are to determine the maximum number of climbers that can use each type of rope on a given climb. \InputFile The input consists of a number of cases. Each case specifies a climb on a line, as a sequence of pitch lengths as in: \textbf{N P_1 P_2 ... P_N} Here \textbf{N} is the positive number of pitches, with \textbf{1} ≤ \textbf{N} ≤ \textbf{100}, and \textbf{P_k} is the positive integer length (in meters) of each pitch, with \textbf{1} ≤ \textbf{P_k} ≤ \textbf{100}. The last line (indicating the end of input) is a single \textbf{0}. \OutputFile Three numbers for each climb separated by a space, indicating the maximum number of climbers that could use the \textbf{50}, \textbf{60}, or \textbf{70} meter rope lengths, respectively. State \textbf{0} if the given rope length is not suitable for that climb.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
1 25
2 10 20
0
Çıxış verilənləri #1
3 3 3
0 4 4
Mənbə 2010 Rocky Mountain North America, October 30, Problem B