시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 512 MB | 85 | 76 | 71 | 92.208% |
For over 600 years, the hourglass has been a well-known timekeeping instrument. An hourglass consists of two glass flasks arranged one above the other which are connected by a narrow channel. Inside the hourglass there is sand which slowly flows from the upper to the lower flask. Hourglasses are typically symmetrical so that the sand always takes the same amount of time to run through, regardless of orientation. For the purposes of this problem, we also assume that the flow rate of the sand is a known constant and does not depend on the amount or distribution of sand in the upper half.
Your friend Helen was bored and has been playing around with her hourglass. At time $0$, all the sand was in the lower half. Helen flipped the hourglass over several times and recorded all the moments at which she did so. How many seconds does she need to wait from the current time until all the sand is back in the lower half?
The input consists of:
All times are given in seconds. You may assume that the sand flows from the top to the bottom at a constant rate of $1$ gram per second.
Output the time in seconds needed for the hourglass to run out starting from time $t$.
10 7 2 4 9
4
2000 333 3 1000 1250 1500
0
100 10 5 15 20 93 96 97
5
ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2020 F번