This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//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;
double ans = 0;
multiset<int> s;
double calc(int x){
if(x >= d) return 0;
else return (d - x) / 2.0;
}
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 << " ";
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |