PROBLEM LINK:
Author: Dmytro Berezin
Tester: Mahbubul Hasan
Editorialist: Jingbo Shang
DIFFICULTY:
Cakewalk
PREREQUISITES:
Programming
PROBLEM:
Given a sequence of numbers W[0…N-1], find out a number S, such that S - i >= W[i] holds for all 0 <= i < N.
EXPLANATION:
It is easy to find out the choice of decreasing speed is to decrease it by 1 after each segment. So we can have the above problem.
After some transformations, the requirement is that S >= W[i] + i holds for all 0 <= i < N. Therefore, simply let S be the maximum of W[i]+i is the best choice.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here.
Tester’s solution can be found here.