#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
lld absol(lld x){
if(x>0)return x;
return -x;
}
int main(){
int n;
cin>>n;
lld arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
lld ans=20000000000;
for(int i=0;i<n-1;i++)ans=min(ans,absol(arr[i]-arr[i+1]));
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
47 ms |
1884 KB |
Output is correct |
6 |
Correct |
68 ms |
1912 KB |
Output is correct |
7 |
Correct |
48 ms |
1884 KB |
Output is correct |