Tusk has been stranded on an island for some time now, and it's fair to say that he's grown terribly bored. As such, he's started to find ordinary things immensely fascinating.
Today, he's interested in the waves he sees. He notes that at certain times of the day, the water level either increases or decreases. Realizing this phenomenon is due to tides, he is now most fervent about determining the difference in water level between high tide and low tide.
To this end, he's measured the water level times throughout the day using a high-precision measuring device such that each reading is a unique integer in the range inclusive.
He knows that after measuring the absolute minimum reading at low tide, the transition to the absolute maximum reading representing the water level at high tide consists of a strictly increasing sequence of water level readings. He's interested in the difference between the absolute maximum and absolute minimum readings: the water level difference between tides.
It's possible that he made a mistake in writing down these readings, however, in which case the sequence between the low tide reading and high tide reading will not be strictly increasing. If this is the case, it's likely that the data is useless — the water level difference cannot be accurately determined — and should be scrapped.
Input Specification
The first line will contain the single integer .
The second line will contain space-separated positive integers: the water level readings in chronological order.
Output Specification
The integer difference in water level between high tide and low tide. If the difference cannot be accurately determined, output unknown
.
Sample Input 1
5
2 1 3 5 10
Sample Output 1
9
Sample Input 2
5
1 2 5 4 9
Sample Output 2
unknown
Comments
I only AC the first two test cases, anybody know why? I cant find the problem :[
This comment is hidden due to too much negative feedback. Show it anyway.
python isn't the only language y'know
It is much more convenient in many languages to have the number of inputs specified. You will find that almost all problems specify the number of tokens for this reason.