Submission #683318

#TimeUsernameProblemLanguageResultExecution timeMemory
683318nutellaMeasures (CEOI22_measures)C++17
24 / 100
42 ms3788 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, D; cin >> n >> m >> D; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } vector<int> b(m); for (int i = 0; i < m; ++i) { cin >> b[i]; } if (n > 0) { sort(a.begin(), a.end()); for (int i = 0; i < m; ++i) { a.insert(lower_bound(a.begin(), a.end(), b[i]), b[i]); ll ans = numeric_limits<ll>::min(), mx = numeric_limits<ll>::min(); for (int k = size(a) - 1; k >= 0; --k) { mx = max(mx, 1LL * D * k - a[k]); ans = max(ans, mx - 1LL * D * k + a[k]); } if (ans % 2 == 0) { cout << ans / 2 << ' '; } else { cout << ans / 2 << ".5 "; } } } else { assert(false); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...