# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1056840 |
2024-08-13T11:40:30 Z |
TimAni |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
31720 KB |
// time-limit: 3000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct point {
double x{}, y{};
};
void solve() {
int n;
double L;
cin >> n >> L;
vector<point> p(n);
for(int i = 0; i < n; i++) {
cin >> p[i].x >> p[i].y;
}
auto doubleersection = [&](const point& A, double R) -> array<double, 2> {
// y^2 = 0,
// y^2 = R^2 - (x - A.x)^2 + 2yA.y - A.y ^ 2;
// R^2 - (x - A.x) ^ 2 - A.y^2 = 0
// R^2 - x^2 + 2xA.x - A.x^2 - A.y^2 = 0
// x^2 - 2xA.x + A.x^2 + A.y^2 - R^2 = 0
// D = -4A.y^2 + 4R^2
if(abs(A.y) > R) {
return {1.0 + L, -1.};
}
double D = 4. * (R * R - A.y * A.y);
double x1 = (2. * A.x - sqrt(D)) / 2.;
double x2 = (2. * A.x + sqrt(D)) / 2.;
if(x2 < x1) swap(x1, x2);
if(x1 < 0) x1 = 0;
if(x2 > L) x2 = L;
return {x1, x2};
};
auto good = [&](double R) {
vector<array<double, 2>> segs(n);
for(double i = 0; i < n; i++) {
segs[i] = doubleersection(p[i], R);
}
sort(segs.begin(), segs.end());
double l = segs[0][0], r = segs[0][1];
int i = 0;
while(i + 1 < n && segs[i + 1][0] < r) {
r = max(segs[i + 1][1], r);
i++;
}
return r >= L && l <= 0;
};
double l = 0, r = hypot(2 * 1e9, 2 * 1e9) + 1;
for(int i = 0; i < 100; i++) {
double R = (r + l) / 2;
if(good(R)) {
r = R;
}
else {
l = R;
}
}
cout << fixed << setprecision(6) << r << endl;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
double T = 1;
//cin >> T;
while(T--) solve();
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 |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
271 ms |
2760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
420 ms |
2908 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
343 ms |
3200 KB |
Output is correct |
2 |
Correct |
416 ms |
2908 KB |
Output is correct |
3 |
Correct |
473 ms |
3932 KB |
Output is correct |
4 |
Incorrect |
674 ms |
5508 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
392 ms |
3420 KB |
Output is correct |
2 |
Correct |
534 ms |
3420 KB |
Output is correct |
3 |
Correct |
520 ms |
4444 KB |
Output is correct |
4 |
Incorrect |
622 ms |
5536 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
414 ms |
3416 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1047 ms |
16076 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1033 ms |
16072 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1022 ms |
19120 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1033 ms |
19120 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
22356 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1039 ms |
22352 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1020 ms |
25464 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1057 ms |
25428 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1043 ms |
31716 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1043 ms |
31720 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |