#include <bits/stdc++.h>
#define MAX_INT 10000000000
using namespace std;
int main() {
int n;
cin >> n;
long min_interval = MAX_INT;
long prev;
cin >> prev;
for (int i = 1; i < n; i++) {
long next;
cin >> next;
min_interval = min(abs(next - prev), min_interval);
prev = next;
}
cout << min_interval << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
40 ms |
1288 KB |
Output is correct |
6 |
Correct |
49 ms |
1272 KB |
Output is correct |
7 |
Correct |
43 ms |
1144 KB |
Output is correct |