#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
using namespace std;
const int oo = 2e9;
const int N = 100100;
int n, a[N];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = oo;
for (int i = 1; i < n; i++)
ans = min(ans, abs(a[i] - a[i - 1]));
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
16 ms |
768 KB |
Output is correct |
6 |
Correct |
20 ms |
768 KB |
Output is correct |
7 |
Correct |
17 ms |
640 KB |
Output is correct |