#C6116. Maximum Consecutive Difference
Maximum Consecutive Difference
Maximum Consecutive Difference
You are given a list of execution times of code segments measured in milliseconds. Your task is to compute the maximum absolute difference between the execution times of any two consecutive segments.
The difference is calculated as \( |a_i - a_{i-1}| \) for each consecutive pair \( (a_{i-1}, a_i) \) and the maximum of these differences is the answer.
Note: Input is taken from standard input and output should be written to standard output.
inputFormat
The first line contains an integer ( n ) representing the number of recorded execution times. The second line contains ( n ) space-separated integers representing the execution times in milliseconds.
outputFormat
Output a single integer representing the maximum absolute difference between any two consecutive execution times.## sample
5
10 20 30 50 40
20
</p>