This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int N, T;
cin >> N >> T;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
for (int i = 0; i < N; i++) {
A[i] %= T;
}
sort (A.begin(), A.end());
int len_min = A[N-1] - A[0];
for (int i = 0; i < N-1; i++) {
len_min = min(len_min, T - (A[i+1] - A[i]));
}
cout << (len_min + 1) / 2 << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |