Submission #1011160

#TimeUsernameProblemLanguageResultExecution timeMemory
1011160vjudge1Mobile (BOI12_mobile)C++17
0 / 100
291 ms16796 KiB
#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 len; std::cin >> n >> len; double ans = 0; Point l{0, 0}, r{len, 0}, pre, cur; for (int i = 0; i < n; i++) { auto &[x2, y2] = cur; std::cin >> x2 >> y2; ans = std::max(ans, std::min(dist(l, cur), dist(r, cur))); if (i != 0) { auto [x1, y1] = pre; if (y1 == y2) { continue; } double x0 = insec(pre, cur); if (x0 > 0 && x0 < len) { Point mid{x0, 0}; ans = std::max(ans, std::min(dist(pre, mid), dist(cur, mid))); } } pre = cur; } std::cout << std::fixed << std::setprecision(6) << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...