//full bài 2
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 2e5 + 25;
int a[maxn], b[maxn];
int n, m, d;
int ans = 0;
multiset<int> s;
int calc(int x){
if(x >= d) return 0;
else return (d - x);
}
void ins(int x){
s.insert(x);
auto it1 = s.find(x);
auto it2 = it1;
it1++;
it2--;
ans += calc((*it1) - x);
ans += calc(x - (*it2));
ans -= calc((*it1) - (*it2));
}
void solve(){
cin >> n >> m >> d;
s.insert(-1e9);
s.insert(1e10);
for(int i = 1; i <= n; i++){
cin >> a[i];
ins(a[i]);
//cout << ans << " ";
}
for(int i = 1; i <= m; i++){
cin >> b[i];
ins(b[i]);
cout << ans / 2 << (ans % 2 ? ".5 " : " ");
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
103 ms |
15352 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
103 ms |
15352 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |