#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int n;
cin >> n;
vector <int> vec(n);
for(int &i : vec) cin >> i;
int ans = INT_MAX;
for(int i = 0; i<n-1; i++) {
ans = min(ans, abs(vec[i]-vec[i+1]));
}
cout << ans << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
24 ms |
1796 KB |
Output is correct |
6 |
Correct |
26 ms |
1548 KB |
Output is correct |
7 |
Correct |
25 ms |
1668 KB |
Output is correct |