Submission #1053597

#TimeUsernameProblemLanguageResultExecution timeMemory
1053597vjudge1Measures (CEOI22_measures)C++17
24 / 100
1571 ms4952 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cassert> #warning That's not the baby, that's my baby #define int ll #define debug(x) #x << " = " << x << '\n' typedef long long ll; signed main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int n, m, D; std::cin >> n >> m >> D; D *= 2; std::vector<int> a; if (n != 0) { a.resize(n); for (auto &x : a) { std::cin >> x; x *= 2; } } auto check = [&](int mid) { ll last = -8e18; for (const auto &x : a) { if (x < last + D - mid) { return false; } last = std::max(last + D, x - mid); } return true; }; while (m--) { int x; std::cin >> x; a.push_back(2 * x); std::sort(a.begin(), a.end()); int l = 0, r = 1e18; while (l < r) { int mid = (l + r) / 2; if (check(mid)) { r = mid; } else { l = mid + 1; } } std::cout << r / 2; if (r % 2) { std::cout << ".5"; } std::cout << ' '; } return 0; }

Compilation message (stderr)

Main.cpp:5:2: warning: #warning That's not the baby, that's my baby [-Wcpp]
    5 | #warning That's not the baby, that's my baby
      |  ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...