# include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair <int, int>
using namespace std;
const int N = 3e5 + 5;
int t,n,a[N],cur,le,ri;
main() {
std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n;
for (int i = 1; i <= n; i++) {
cin>>a[i];
}
int ans = 2e9;
for (int i = 1; i < n ;i++) {
ans = min(ans, abs(a[i] - a[i + 1]));
}
cout<<ans<<endl;
}
Compilation message
pismo.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
9 | main() {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
8 ms |
588 KB |
Output is correct |
6 |
Correct |
9 ms |
616 KB |
Output is correct |
7 |
Correct |
10 ms |
588 KB |
Output is correct |