#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=5e5+5;
ll n, x, t, res=LLONG_MAX;
vector<ll> v;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>t;
for (int i=1; i<=n; i++) cin>>x, v.push_back(x%t), v.push_back(x%t+t);
sort(v.begin(), v.end());
for (int i=0; i<n; i++) res=min(res, (v[i+n-1]-v[i]+1)/2);
cout<<res;
}
# | 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... |