Mock CCO '18 Contest 2 Problem 1 - Victor Runs
View as PDFVictor, as a mathematician, reasons best in  dimensions. What happens if he is made to reason
in one dimension?
Victor's gym teacher, Roger, has set up an obstacle course of sorts for Victor. The obstacle course is modeled after
the number line, with checkpoints at one of  locations. Victor has 
 seconds to get to as many checkpoints as
possible. Victor can run at the speed of one unit per second. If Victor first reaches a checkpoint 
 seconds into the
obstacle course, Victor earns 
 points. Victor starts at the origin and can end at any location.
Compute the maximum number of points Victor can earn, given the configuration Roger has set up for him.
Constraints
All  are distinct.
Input Specification
The first line will contain two space-separated integers,  and 
.
Each of the next  lines will contain a single integer, 
, representing
one of the locations where a checkpoint is located at.
Output Specification
Print, on a single line, the maximum score Victor can obtain if he runs optimally.
Sample Input
3 15
6
-3
1
Sample Output
25
Comments