#include <bits/stdc++.h>
using namespace std;
const int DIM = 1e5 + 5;
int N, ans;
int arr[DIM];
int main(){
cin >> N;
for( int i = 1; i <= N; i++ )
cin >> arr[i];
ans = 0x3f3f3f3f;
for( int i = 2; i <= N; i++ )
ans = min( ans, (int)( abs( arr[i] - arr[i - 1] ) ) );
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
424 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
70 ms |
1584 KB |
Output is correct |
6 |
Correct |
74 ms |
1656 KB |
Output is correct |
7 |
Correct |
70 ms |
1528 KB |
Output is correct |