# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
884142 |
2023-12-06T16:06:46 Z |
vjudge1 |
Pismo (COCI18_pismo) |
C++17 |
|
8 ms |
1884 KB |
#include <bits/stdc++.h>
using namespace std;
#define sp << " " <<
#define int long long
#define vi vector<int>
#define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++)
#define pii pair<int,int>
const int N = 2e5+1;
void solve() {
int n;
cin >> n;
vi a(n+1),l(n+1);
F(i,n) cin >> a[i];
int best = 2e18;
for (int i=2;i<=n;i++) {
if (abs(a[i]-a[i-1]) < best) {
best = abs(a[i]-a[i-1]);
}
}
cout << best << endl;
}
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#ifdef Local
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
int t = 1;
//cin >> t;
F(i,t) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
1884 KB |
Output is correct |
6 |
Correct |
8 ms |
1884 KB |
Output is correct |
7 |
Correct |
7 ms |
1628 KB |
Output is correct |