#include <bits/stdc++.h>
using namespace std;
#define N 500005
#define sz size()
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define pt pop_back
#define M 1000000007
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
ll a[N], b, mx, mn, x, y, c, d, t, n, m, k, h, tr;
string s, g;
vector <ll> v;
priority_queue<ll>q1;
priority_queue<ll, vector<ll>, greater<ll>>q;
int main() {
ios::sync_with_stdio(false);cin.tie(0);
cin >> n >> m >> k;
b = n - (k + m);
for(int i = 1; i <= n; i++){
cin >> a[i];
}
// cout << b << '\n';
// return 0;
sort(a + 1, a + n + 1);
for(int i = 1; i < n; i++){
q1.push(a[i + 1] - a[i] + 1);
}
while(k != 0){
q1.pop();
k--;
}
while(!q1.empty()){
q.push(q1.top());
q1.pop();
}
while(b){
if(q.top() % 2 == 0)h = max(h, q.top() / 2);
else h = max(h, q.top() / 2 + 1);
q.pop();
b--;
}
cout << h << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |