Submission #1011172

# Submission time Handle Problem Language Result Execution time Memory
1011172 2024-06-30T03:38:26 Z vjudge1 Mobile (BOI12_mobile) C++17
0 / 100
267 ms 16644 KB
#include <bits/stdc++.h>
using i64 = long long;

struct Point {
    double x, y;
};

double dist(const Point &a, const Point &b) {
    double dx = a.x - b.x;
    double dy = a.y - b.y;
    return std::sqrt(dx * dx + dy * dy);
}

double insec(const Point &a, const Point &b) {
    double t1 = b.x * b.x + b.y * b.y - a.x * a.x - a.y * a.y;
    double t2 = b.x - a.x;
    return t1 / t2 / 2;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n;
    double l;
    std::cin >> n >> l;

    std::deque<Point> pt;
    for (int i = 0; i < n; i++) {
        double x, y;
        std::cin >> x >> y;
        y = std::abs(y);

        if (pt.size() && pt.back().x == x) {
            if (pt.back().y <= y) {
                continue;
            } else {
                pt.pop_back();
            }
        }
        pt.push_back({x, y});
    }

    double ans = 0;
    Point lt{0, 0}, rt{l, 0};
    for (int i = 0; i < (int)pt.size(); i++) {
        if (i > 0) {
            lt.x = insec(pt[i], pt[i - 1]);
        }
        if (i + 1 < (int)pt.size()) {
            rt.x = insec(pt[i], pt[i + 1]);
        }
        if (lt.x < 0 || lt.x > l || rt.x < 0 || rt.x > l) {
            continue;
        }
        ans = std::max({ans, dist(lt, pt[i]), dist(pt[i], rt)});
    }
    std::cout << std::fixed << std::setprecision(6) << ans << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 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 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 116 ms 8480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 127 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 139 ms 10208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 154 ms 348 KB Output is correct
2 Incorrect 152 ms 9944 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 167 ms 11784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 233 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 182 ms 13536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 210 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 236 ms 16644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 267 ms 456 KB Output isn't correct
2 Halted 0 ms 0 KB -