Submission #1118144

# Submission time Handle Problem Language Result Execution time Memory
1118144 2024-11-25T04:32:08 Z nguyenkhangninh99 Measures (CEOI22_measures) C++14
0 / 100
166 ms 14156 KB
//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
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 166 ms 14156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 166 ms 14156 KB Output isn't correct
2 Halted 0 ms 0 KB -