Submission #1118144

#TimeUsernameProblemLanguageResultExecution timeMemory
1118144nguyenkhangninh99Measures (CEOI22_measures)C++14
0 / 100
166 ms14156 KiB
//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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...