#include <bits/stdc++.h>
using namespace std ;
const int MAX = 1e5 + 10 ;
int n ;
int arr[MAX] ;
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
cin>>n ;
for(int i = 0 ; i < n ; ++i)
cin>>arr[i] ;
int ans = 1e9 ;
for(int i = 0 ; i < n-1 ; ++i)
ans = min(ans , abs(arr[i] - arr[i+1])) ;
return cout<<ans<<"\n" , 0 ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
380 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
24 ms |
1632 KB |
Output is correct |
6 |
Correct |
20 ms |
1656 KB |
Output is correct |
7 |
Correct |
20 ms |
1528 KB |
Output is correct |