# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
470634 |
2021-09-04T16:11:46 Z |
zxcvbnm |
Mobile (BOI12_mobile) |
C++14 |
|
490 ms |
15980 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
struct P {
ll x, y;
};
vector<P> a;
int n, L;
bool ok(double r) {
double curr = 0;
for(int i = 0; i < n; i++) {
if (r * r < a[i].y * a[i].y) continue;
double sol = sqrt(r * r - a[i].y * a[i].y);
double left = max((double) 0, a[i].x - sol);
double right = min((double) L, a[i].x + sol);
if (left <= curr) {
curr = max(curr, right);
}
}
return curr >= L;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> L;
a.resize(n);
for(auto& i : a) {
cin >> i.x >> i.y;
}
double l = 0, r = 1e9;
double ans = r;
for(int rep = 0; rep < 39; rep++) {
double mid = (l + r) / 2;
if (ok(mid)) {
r = mid;
ans = mid;
}
else {
l = mid;
}
}
cout << fixed << setprecision(6) << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
332 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
4 |
Incorrect |
3 ms |
332 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
332 KB |
Output is correct |
2 |
Correct |
4 ms |
332 KB |
Output is correct |
3 |
Incorrect |
3 ms |
332 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1484 KB |
Output is correct |
2 |
Incorrect |
36 ms |
1484 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
1484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
39 ms |
1612 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
1868 KB |
Output is correct |
2 |
Correct |
49 ms |
1868 KB |
Output is correct |
3 |
Incorrect |
42 ms |
1868 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
1868 KB |
Output is correct |
2 |
Correct |
57 ms |
1868 KB |
Output is correct |
3 |
Correct |
43 ms |
1868 KB |
Output is correct |
4 |
Correct |
40 ms |
1868 KB |
Output is correct |
5 |
Correct |
39 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
227 ms |
8140 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
244 ms |
8140 KB |
Output is correct |
2 |
Incorrect |
266 ms |
8140 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
265 ms |
9676 KB |
Output is correct |
2 |
Incorrect |
289 ms |
9704 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
293 ms |
9652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
11212 KB |
Output is correct |
2 |
Incorrect |
342 ms |
11212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
355 ms |
11212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
347 ms |
12748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
388 ms |
12748 KB |
Output is correct |
2 |
Incorrect |
399 ms |
12748 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
439 ms |
15948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
485 ms |
15948 KB |
Output is correct |
2 |
Incorrect |
490 ms |
15980 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |