# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
230423 |
2020-05-10T06:20:38 Z |
NONAME |
Pismo (COCI18_pismo) |
C++17 |
|
18 ms |
768 KB |
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;
int n, a[N], ans = -1;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n - 1; i++)
ans = (ans == -1 ? abs(a[i] - a[i + 1]) : min(ans, abs(a[i] - a[i - 1])));
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
17 ms |
768 KB |
Output is correct |
6 |
Correct |
18 ms |
768 KB |
Output is correct |
7 |
Correct |
18 ms |
640 KB |
Output is correct |