#include <bits/stdc++.h>
#define rep(i, a, b) for(int i=(a) ; i<=(b) ; ++i)
#define mp make_pair
#define pii pair<int, int>
#define PB push_back
#define F first
#define S second
#define Task "pismo"
using namespace std;
const int N=100005;
int n, a[N];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(Task".inp", "r", stdin);
//freopen(Task".out", "w", stdout);
cin >> n;
int ans=2e9;
rep(i, 1, n) {
cin >> a[i];
if(i>=2) ans=min(ans, abs(a[i]-a[i-1]));
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
352 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
13 ms |
632 KB |
Output is correct |
6 |
Correct |
13 ms |
632 KB |
Output is correct |
7 |
Correct |
13 ms |
636 KB |
Output is correct |