Submission #1093752

# Submission time Handle Problem Language Result Execution time Memory
1093752 2024-09-27T11:11:26 Z michified Mobile (BOI12_mobile) C++17
60 / 100
1000 ms 35156 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define lid id * 2 + 1
#define rid id * 2 + 2
using namespace std;

const ll mod = 1e9 + 7;

struct coord_t {
    ll x, y;
};

bool all(ld rad, ld l, vector<coord_t>& towers) {
    ld cur = 0, radsq = rad * rad;
    for (auto& t : towers) {
        if (t.y > rad) continue;
        ld horiz = sqrtl(radsq - (t.y * t.y));
        if (t.x - horiz > cur) continue;
        cur = max(cur, t.x + horiz);
    }
    return cur >= l;
}

int main() {
    // ifstream cin("valleys.in");
    // ofstream cout("valleys.out");
    
    ld n, L, i;
    ll tx, ty;
    cin >> n >> L;
    vector<coord_t> towers(n);
    for (i = 0; i < n; i++) {
        cin >> tx >> ty;
        towers[i] = {tx, ty};
    }
    ld l = 1, r = 1.5e9, tol = 0.001;
    while (l < r - tol) {
        ld mid = (l + r) / 2;
        if (not all(mid, L, towers)) l = mid;
        else r = mid;
    }
    cout << setprecision(10) << l;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 352 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 3 ms 352 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 4 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 352 KB Output is correct
2 Correct 3 ms 352 KB Output is correct
3 Correct 4 ms 352 KB Output is correct
4 Correct 6 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 576 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 352 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 2388 KB Output is correct
2 Correct 46 ms 2712 KB Output is correct
3 Correct 27 ms 1788 KB Output is correct
4 Correct 81 ms 2780 KB Output is correct
5 Correct 30 ms 1624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 2392 KB Output is correct
2 Correct 63 ms 2136 KB Output is correct
3 Correct 77 ms 2652 KB Output is correct
4 Correct 84 ms 2648 KB Output is correct
5 Correct 98 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 2484 KB Output is correct
2 Correct 50 ms 2856 KB Output is correct
3 Correct 44 ms 2652 KB Output is correct
4 Correct 126 ms 3892 KB Output is correct
5 Correct 72 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 3408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 68 ms 3412 KB Output is correct
2 Correct 60 ms 3152 KB Output is correct
3 Correct 48 ms 2900 KB Output is correct
4 Correct 122 ms 3916 KB Output is correct
5 Correct 98 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 12372 KB Output is correct
2 Incorrect 296 ms 15956 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 317 ms 16436 KB Output is correct
2 Correct 332 ms 14672 KB Output is correct
3 Correct 252 ms 13908 KB Output is correct
4 Correct 603 ms 17328 KB Output is correct
5 Correct 521 ms 15532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 304 ms 14992 KB Output is correct
2 Incorrect 366 ms 19028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 370 ms 19552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 351 ms 17236 KB Output is correct
2 Incorrect 422 ms 22100 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 440 ms 22864 KB Output is correct
2 Correct 456 ms 20588 KB Output is correct
3 Correct 356 ms 19536 KB Output is correct
4 Correct 864 ms 24684 KB Output is correct
5 Correct 710 ms 21508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 408 ms 19796 KB Output is correct
2 Incorrect 487 ms 25172 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 507 ms 25936 KB Output is correct
2 Correct 526 ms 23632 KB Output is correct
3 Correct 430 ms 22352 KB Output is correct
4 Correct 994 ms 28304 KB Output is correct
5 Correct 821 ms 24336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 522 ms 24640 KB Output is correct
2 Incorrect 651 ms 31560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 645 ms 32596 KB Output is correct
2 Correct 624 ms 29268 KB Output is correct
3 Correct 536 ms 28240 KB Output is correct
4 Execution timed out 1040 ms 35156 KB Time limit exceeded
5 Halted 0 ms 0 KB -