#include <bits/stdc++.h>
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 260000
#define pa pair<ll, ll>
#define ld long double
ll arr[mn];
int main(){
ll n, ans=llmax;cin >> n;
loop(i, 0, n){
cin >> arr[i];
if(i>0) ans=min(ans, abs(arr[i]-arr[i-1]));
}
cout << ans <<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
76 ms |
1912 KB |
Output is correct |
6 |
Correct |
82 ms |
1912 KB |
Output is correct |
7 |
Correct |
76 ms |
1912 KB |
Output is correct |