A Simple Minus

View as PDF

Points:10
Time limit:0.2s
Assembly (ARM)0.5s
Memory limit:1M
Assembly (ARM)4M
Authors:

Problem type

Allowed languages
Assembly

Your computer engineering instructor decided to ramp things up a bit (in terms of difficulty, of course) with this next task:

Write a program to find the maximum difference between the of adjacent elements of a given array.

More formally,

Given an array , find the maximum value of for some and , where .

Unimpressed by the supposed "challenge", you open up your favourite text editor and begin typing away... in assembly.

Input Specification

The first line of input will contain a single integer .

The second line of input will contain space-separated integers in the range , denoting the contents of array .

Output Specification

The desired integer value as defined by your teacher on a line by itself.

Sample Input

3
3 2 1


Sample Output

2


Explanation

We can find the maximum value when and :

Note

To use libc in NASM, the first line of your program should be ; libc. For all others, it should be ; features: libc.

Language Constraints

Because Assembly (ARM) runs under qemu, it is allocated 0.5s and 4096kb of RAM.