speedlimit - bradendubois/competitive-programming GitHub Wiki

Speed Limit

ID: speedlimit

Difficulty: 1.5

CPU Time: 1 second

Memory: 1024 MB

Solution

This one is trivial; have a total of miles driven initialized to 0, and read in each line for a set, tracking the "previous time", and simply add s * (t - prev (initialized to 0)) and update prev to the current time, repeat for each set.