#include <bits/stdc++.h>
using namespace std;
int main(){
int n, ans = 1e9;
cin >> n;
int v[n];
for(int i = 0; i < n; i++)cin >> v[i];
for(int i = 1; i < n; i++) ans = min(ans, max(v[i] - v[i - 1], v[i - 1] - v[i]));
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
25 ms |
1484 KB |
Output is correct |
6 |
Correct |
27 ms |
1540 KB |
Output is correct |
7 |
Correct |
24 ms |
1396 KB |
Output is correct |