#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int INF = 1e9+7;
vector<int>v;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,t,x,m,res=INF;
cin>>n>>t;
for(int i=1;i<=n;i++){
cin>>x;
x%=t;
v.pb(x);
v.pb(x-t);
}
sort(v.begin(),v.end());
for(int i=n-1;i<v.size();i++){
m=v[i-n+1];
res=min(res,(v[i]-m+1)/2);
}
cout<<res<<'\n';
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... |