#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;
}
int32_t 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<<" ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1570 ms |
784 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1570 ms |
784 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |