#include<bits/stdc++.h>
using namespace std;
#define int long long
int double_cost(multiset<int>& s, int d){
int delta = 0;
int first = *s.begin();
multiset<int> s2;
for(auto e: s){
s2.insert(e-first);
}
int rank = 0;
int cost =0;
//cout<<"size "<<s2.size()<<endl;
for(auto e: s2){
//cout<<"element "<<e<<endl;
if(rank*d + delta< e){
delta += e - rank*d;
}
//cout<<rank<<endl;
cost = max(cost, rank*d + delta - e);
rank++;
}
return cost;
}
int main(){
int n, m, d;
cin>>n>>m>>d;
multiset<int> ppl;
for(int i = 0; i<n; i++){
int a;
cin>>a;
ppl.insert(a);
}
for(int i = 0; i<m; i++){
int b;
cin>>b;
ppl.insert(b);
cout<<(double)double_cost(ppl, d) / 2.0<<" ";
}
}
Compilation message
cc1plus: error: '::main' must return 'int'