# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
470632 |
2021-09-04T16:09:06 Z |
zxcvbnm |
Mobile (BOI12_mobile) |
C++14 |
|
493 ms |
15948 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 < 40; rep++) {
double mid = (l + r) / 2;
if (rep == 0) mid = 1;
else if (r > 1) mid = sqrt((long double) l * r);
if (ok(mid)) {
r = mid;
ans = mid;
}
else {
l = mid;
}
}
cout << fixed << setprecision(6) << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 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 |
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 |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 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 |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
1484 KB |
Output is correct |
2 |
Correct |
37 ms |
1504 KB |
Output is correct |
3 |
Correct |
25 ms |
1100 KB |
Output is correct |
4 |
Correct |
25 ms |
1484 KB |
Output is correct |
5 |
Correct |
14 ms |
1100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
1484 KB |
Output is correct |
2 |
Correct |
25 ms |
1356 KB |
Output is correct |
3 |
Correct |
25 ms |
1484 KB |
Output is correct |
4 |
Correct |
25 ms |
1484 KB |
Output is correct |
5 |
Correct |
29 ms |
1612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
1612 KB |
Output is correct |
2 |
Correct |
39 ms |
1484 KB |
Output is correct |
3 |
Correct |
37 ms |
1612 KB |
Output is correct |
4 |
Correct |
37 ms |
1868 KB |
Output is correct |
5 |
Correct |
26 ms |
1612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
48 ms |
1868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
1868 KB |
Output is correct |
2 |
Correct |
48 ms |
1868 KB |
Output is correct |
3 |
Correct |
40 ms |
1868 KB |
Output is correct |
4 |
Correct |
40 ms |
1868 KB |
Output is correct |
5 |
Correct |
30 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
217 ms |
8136 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
251 ms |
8140 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
260 ms |
9676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
302 ms |
9676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
308 ms |
11212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
341 ms |
11212 KB |
Output is correct |
2 |
Correct |
363 ms |
11212 KB |
Output is correct |
3 |
Correct |
288 ms |
11212 KB |
Output is correct |
4 |
Correct |
240 ms |
11212 KB |
Output is correct |
5 |
Correct |
220 ms |
11212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
345 ms |
12812 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
402 ms |
12748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
429 ms |
15948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
493 ms |
15948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |