# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1011173 |
2024-06-30T03:41:07 Z |
vjudge1 |
Mobile (BOI12_mobile) |
C++17 |
|
312 ms |
16636 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});
}
while ((int)pt.size() > 1 && insec(pt[0], pt[1]) < 0) {
pt.pop_front();
}
while ((int)pt.size() > 1 && insec(pt[pt.size() - 1], pt[pt.size() - 2]) > l) {
pt.pop_back();
}
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 |
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 |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 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 |
18 ms |
1372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1116 KB |
Output is correct |
2 |
Incorrect |
28 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
1896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
153 ms |
8420 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
132 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 |
155 ms |
348 KB |
Output is correct |
2 |
Incorrect |
160 ms |
10144 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
169 ms |
11744 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
220 ms |
452 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
194 ms |
13512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
312 ms |
16636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
263 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |