#include<bits/stdc++.h>
using namespace std;
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<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1548 ms |
1004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1548 ms |
1004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |