#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::pair;
using std::tuple;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
std::cin >> N;
vector<int> A(N);
for (auto& x : A) {
std::cin >> x;
}
int ans = 1000000000;
for (int i = 1; i < N; ++i) {
ans = std::min(ans, std::abs(A[i] - A[i - 1]));
}
std::cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
10 ms |
1432 KB |
Output is correct |
6 |
Correct |
10 ms |
1552 KB |
Output is correct |
7 |
Correct |
10 ms |
1420 KB |
Output is correct |