#include <iostream>
using namespace std;
int main(){
int n,sol=1e9;
cin>>n;
int v[n];
for(int i=0;i<n;i++)cin>>v[i];
for(int i=1;i<n;i++){
sol=min(sol,max(v[i]-v[i-1],v[i-1]-v[i]));
}
cout<<sol;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
39 ms |
1484 KB |
Output is correct |
6 |
Correct |
56 ms |
1512 KB |
Output is correct |
7 |
Correct |
42 ms |
1500 KB |
Output is correct |