Submission #435335

# Submission time Handle Problem Language Result Execution time Memory
435335 2021-06-23T08:17:59 Z palilo Mobile (BOI12_mobile) C++17
100 / 100
599 ms 27608 KB
#include <bits/stdc++.h>
using namespace std;

template <class T>
bool chmin(T& _old, T _new) { return _old > _new && (_old = _new, true); }
template <class T>
bool chmax(T& _old, T _new) { return _old < _new && (_old = _new, true); }

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
#ifdef palilo
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    int n, l;
    cin >> n >> l;

    vector<pair<int, int>> a(n);
    for (auto& [x, y] : a) cin >> x >> y;

    double lo = 0, hi = sqrt(5e18);
    while (hi - lo > 1e-4) {
        double mid = (lo + hi) / 2, ed = 0;
        for (const auto& [x, y] : a) {
            double dx = sqrt(mid * mid - double(y) * y);
            if (x - dx <= ed) chmax(ed, x + dx);
        }
        (ed < l ? lo : hi) = mid;
    }

    cout << fixed << setprecision(9)
         << (lo + hi) / 2;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 324 KB Output is correct
3 Correct 3 ms 396 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 1612 KB Output is correct
2 Correct 33 ms 1860 KB Output is correct
3 Correct 23 ms 1240 KB Output is correct
4 Correct 40 ms 2052 KB Output is correct
5 Correct 26 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1592 KB Output is correct
2 Correct 38 ms 1628 KB Output is correct
3 Correct 41 ms 1868 KB Output is correct
4 Correct 45 ms 2124 KB Output is correct
5 Correct 47 ms 2400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1648 KB Output is correct
2 Correct 37 ms 2124 KB Output is correct
3 Correct 46 ms 1868 KB Output is correct
4 Correct 58 ms 3016 KB Output is correct
5 Correct 44 ms 1896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 2636 KB Output is correct
2 Correct 43 ms 2508 KB Output is correct
3 Correct 44 ms 2124 KB Output is correct
4 Correct 62 ms 3012 KB Output is correct
5 Correct 58 ms 2248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 2508 KB Output is correct
2 Correct 48 ms 2504 KB Output is correct
3 Correct 46 ms 2116 KB Output is correct
4 Correct 70 ms 3004 KB Output is correct
5 Correct 64 ms 2244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 193 ms 8448 KB Output is correct
2 Correct 230 ms 11844 KB Output is correct
3 Correct 242 ms 11384 KB Output is correct
4 Correct 310 ms 13684 KB Output is correct
5 Correct 257 ms 10996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 236 ms 12360 KB Output is correct
2 Correct 306 ms 10748 KB Output is correct
3 Correct 255 ms 9928 KB Output is correct
4 Correct 292 ms 13552 KB Output is correct
5 Correct 256 ms 11460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 239 ms 10172 KB Output is correct
2 Correct 253 ms 14276 KB Output is correct
3 Correct 267 ms 13616 KB Output is correct
4 Correct 358 ms 16920 KB Output is correct
5 Correct 313 ms 12936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 261 ms 14788 KB Output is correct
2 Correct 357 ms 12804 KB Output is correct
3 Correct 249 ms 11776 KB Output is correct
4 Correct 353 ms 16708 KB Output is correct
5 Correct 305 ms 13640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 257 ms 11924 KB Output is correct
2 Correct 297 ms 16520 KB Output is correct
3 Correct 299 ms 16028 KB Output is correct
4 Correct 395 ms 19268 KB Output is correct
5 Correct 414 ms 14744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 327 ms 17220 KB Output is correct
2 Correct 410 ms 14916 KB Output is correct
3 Correct 302 ms 14092 KB Output is correct
4 Correct 412 ms 19088 KB Output is correct
5 Correct 359 ms 15904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 317 ms 13472 KB Output is correct
2 Correct 352 ms 18972 KB Output is correct
3 Correct 415 ms 18096 KB Output is correct
4 Correct 476 ms 22180 KB Output is correct
5 Correct 426 ms 17708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 417 ms 19888 KB Output is correct
2 Correct 544 ms 17012 KB Output is correct
3 Correct 400 ms 16032 KB Output is correct
4 Correct 566 ms 21920 KB Output is correct
5 Correct 491 ms 18068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 378 ms 16836 KB Output is correct
2 Correct 441 ms 23636 KB Output is correct
3 Correct 426 ms 22624 KB Output is correct
4 Correct 573 ms 27232 KB Output is correct
5 Correct 503 ms 21700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 444 ms 24624 KB Output is correct
2 Correct 599 ms 21316 KB Output is correct
3 Correct 462 ms 20428 KB Output is correct
4 Correct 576 ms 27608 KB Output is correct
5 Correct 585 ms 22872 KB Output is correct