src2020/4093_diao/diao.cpp

21 lines
375 B
C++

#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int n,bus,must,ans=0;
int a[100000];
cin>>n>>bus>>must;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
for(int i=must-1;i<n;i+=must){
int now=a[i]-a[i+1-must];
if(now>ans){
ans=now;
}
}
cout<<ans;
}