codeforces; solve "Long Jumps" from Round #274 (Div. 2)