# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
990607 |
2024-05-30T17:11:35 Z |
Ska |
Mobile (BOI12_mobile) |
C++14 |
|
1000 ms |
63508 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n;
double m;
double x[N], y[N];
pair<double, double> calc(double r, int i) {
if (r < abs(y[i])) {
return {-1, -1};
}
return {x[i] - sqrt(r * r - y[i] * y[i]), x[i] + sqrtl(r * r - y[i] * y[i])};
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
double l = 2e9, r = 1.5e9;
for (int i = 1; i <= n; ++i) {
cin >> x[i] >> y[i];
l = min(l, abs(y[i]));
}
while (r - l >= 1e-3) {
vector<pair<double, double>> segments;
double mid = (l + r) / 2;
for (int i = 1; i <= n; ++i) {
auto x = calc(mid, i);
if (x.first != -1 || x.second != -1) {
segments.emplace_back(x.first, x.second);
}
}
sort(segments.begin(), segments.end());
double bound = 0;
for (auto x : segments) {
if (x.first > bound) {
break;
}
bound = max(bound, x.second);
if (bound >= m) {
break;
}
}
if (bound >= m) {
r = mid;
} else {
l = mid;
}
}
cout << fixed << setprecision(6) << l << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2648 KB |
Output is correct |
2 |
Correct |
3 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2396 KB |
Output is correct |
4 |
Correct |
3 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2780 KB |
Output is correct |
2 |
Correct |
7 ms |
2780 KB |
Output is correct |
3 |
Correct |
9 ms |
2776 KB |
Output is correct |
4 |
Correct |
5 ms |
2764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
2764 KB |
Output is correct |
2 |
Correct |
6 ms |
2776 KB |
Output is correct |
3 |
Correct |
12 ms |
2924 KB |
Output is correct |
4 |
Correct |
5 ms |
2748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
2764 KB |
Output is correct |
2 |
Correct |
8 ms |
2776 KB |
Output is correct |
3 |
Correct |
10 ms |
2764 KB |
Output is correct |
4 |
Correct |
5 ms |
2764 KB |
Output is correct |
5 |
Correct |
7 ms |
2760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
10116 KB |
Output is correct |
2 |
Correct |
192 ms |
10064 KB |
Output is correct |
3 |
Correct |
120 ms |
6872 KB |
Output is correct |
4 |
Correct |
87 ms |
10008 KB |
Output is correct |
5 |
Correct |
78 ms |
6572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
114 ms |
10092 KB |
Output is correct |
2 |
Correct |
104 ms |
8112 KB |
Output is correct |
3 |
Correct |
108 ms |
10116 KB |
Output is correct |
4 |
Correct |
93 ms |
10060 KB |
Output is correct |
5 |
Correct |
88 ms |
10168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
137 ms |
10316 KB |
Output is correct |
2 |
Correct |
217 ms |
10148 KB |
Output is correct |
3 |
Correct |
249 ms |
10176 KB |
Output is correct |
4 |
Correct |
79 ms |
10252 KB |
Output is correct |
5 |
Correct |
132 ms |
10216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
210 ms |
10452 KB |
Output is correct |
2 |
Correct |
279 ms |
10428 KB |
Output is correct |
3 |
Correct |
304 ms |
10420 KB |
Output is correct |
4 |
Correct |
74 ms |
10160 KB |
Output is correct |
5 |
Correct |
135 ms |
10404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
152 ms |
10468 KB |
Output is correct |
2 |
Correct |
274 ms |
10924 KB |
Output is correct |
3 |
Correct |
304 ms |
10488 KB |
Output is correct |
4 |
Correct |
76 ms |
10656 KB |
Output is correct |
5 |
Correct |
131 ms |
10436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
677 ms |
30220 KB |
Output is correct |
2 |
Execution timed out |
1025 ms |
34616 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1074 ms |
33336 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
869 ms |
45144 KB |
Output is correct |
2 |
Execution timed out |
1038 ms |
51532 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
50384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
986 ms |
47500 KB |
Output is correct |
2 |
Execution timed out |
1040 ms |
54128 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
52632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1065 ms |
50196 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1056 ms |
55840 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1044 ms |
56600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1056 ms |
63508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |