# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1011168 |
2024-06-30T03:35:48 Z |
vjudge1 |
Mobile (BOI12_mobile) |
C++17 |
|
308 ms |
25476 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);
while (pt.size() && pt.back().x == x) {
if (pt.back().y >= y) {
pt.pop_back();
} else {
break;
}
}
if (pt.size() && pt.back().x == x) {
continue;
}
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 |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
2 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 |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2136 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
1112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
2484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
3412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
137 ms |
12968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
167 ms |
8664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
152 ms |
15388 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
159 ms |
10324 KB |
Output is correct |
2 |
Incorrect |
163 ms |
17892 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
219 ms |
17892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
228 ms |
12028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
214 ms |
20448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
224 ms |
13652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
262 ms |
25476 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
308 ms |
16980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |