#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5 , mod = 1e9 +7 ;
int n;
int ans = 1e9;
int main()
{
vector< pair<int , int> > v;
cin>>n;
int l= -1;
for(int i = 0;i<n;i++)
{
int t ;
cin>>t;
if(t==l)
continue;
if(i)
ans = min(ans , abs(t - l) );
l = t;
}
cout<<(ans==1e9?0:ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
59 ms |
256 KB |
Output is correct |
6 |
Correct |
64 ms |
376 KB |
Output is correct |
7 |
Correct |
60 ms |
256 KB |
Output is correct |