Submission #888106

# Submission time Handle Problem Language Result Execution time Memory
888106 2023-12-16T03:32:15 Z eysbutno Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 56120 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define all(x) begin(x), end(x)
#define ckmax(a, b) a = max(a, b)
#define ckmin(a, b) a = min(a, b)
#define pb push_back
#define ins insert
#define f first 
#define s second 

int main() {
    cin.tie(0) -> sync_with_stdio(0);
    int n, l; 
    cin >> n >> l;
    vector<pii> loc(n);
    for (auto& i : loc) {
        cin >> i.f >> i.s;
    }
    auto len = [&](ld d, ld y) {
        return sqrt(pow(d, 2) - pow(y, 2));
    };
    auto check = [&](ld d) {
        vector<pair<ld, ld>> itvs(n);
        for (int i = 0; i < n; i++) {
            int x = loc[i].f,
                y = loc[i].s;
            ld dx = len(d, y);
            itvs[i] = {x - dx, x + dx};
        }
        sort(all(itvs));
        if (itvs[0].f > 0) {
            return false;
        }
        ld far = itvs[0].f;
        for (auto& i : itvs) {
            if (i.f > far) {
                return false;
            }
            ckmax(far, i.s);
        }
        return far >= l; // change
    };
    ld low = 0, high = 3e9, prec = 1e-5;
    while (high - low > prec) {
        ld mid = (low + high) / 2;
        if (check(mid)) high = mid;
        else low = mid;
    }
    cout << setprecision(6);
    cout << low << '\n';
}
/**
 * WHY DECIMAL PRECISION??
 * 
 * Binary search the minimum
 * distance needed to cover the
 * highway. That's the answer.
*/
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 700 KB Output is correct
2 Incorrect 13 ms 696 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 354 ms 4188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 504 ms 4184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 267 ms 4500 KB Output is correct
2 Incorrect 412 ms 4896 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 385 ms 5916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 308 ms 5724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 24080 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 28232 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1032 ms 29076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 33876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 33872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1025 ms 39392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 38528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 44972 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 48344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 56120 KB Time limit exceeded
2 Halted 0 ms 0 KB -