#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int n;
int ar[2000006];
signed main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>ar[i];
}
int ans=abs(ar[2]-ar[1]);
for(int i=3;i<=n;i++){
ans=min(ans,abs(ar[i]-ar[i-1]));
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
304 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
25 ms |
1832 KB |
Output is correct |
6 |
Correct |
28 ms |
1844 KB |
Output is correct |
7 |
Correct |
25 ms |
1860 KB |
Output is correct |