#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef pair<int, int> pi;
typedef long long int lint;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
int n;
int a[maxn];
int d = inf;
int main ()
{
ios::sync_with_stdio(0);
cin >> n;
for(int i = 0; i < n; ++i)
cin >> a[i];
for(int i = 1; i < n; ++i)
if(abs(a[i] - a[i - 1]) < d)
d = abs(a[i] - a[i - 1]);
cout << d;
return 0;
}
//written and directed by pcelicamaja
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
13 ms |
1536 KB |
Output is correct |
6 |
Correct |
15 ms |
1664 KB |
Output is correct |
7 |
Correct |
14 ms |
1536 KB |
Output is correct |