# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
477070 |
2021-09-30T05:59:27 Z |
qwerty1234 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
48008 KB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
bool check(double maxDist, vector<pair<double, double>> &transceivers, ll N, ll L) {
vector<pair<double, double>> bounds;
for (int i = 0; i < N; i++) {
double ySquared = transceivers[i].second * transceivers[i].second;
double hypoSquared = maxDist * maxDist;
if (hypoSquared - ySquared < 0) {
continue;
}
double x = sqrt(hypoSquared - ySquared);
bounds.push_back({ max(transceivers[i].first - x, 0.0), min(transceivers[i].first + x, (double)L) });
}
if (bounds.size() == 0) {
return false;
}
double covered = 0;
for (int i = 0; i < (int)bounds.size(); i++) {
if (bounds[i].first <= covered) {
covered = max(covered, bounds[i].second);
}
}
return covered >= (double)L;
}
int main() {
ll N, L;
cin >> N >> L;
vector<pair<double, double>> transceivers(N);
for (int i = 0; i < N; i++) cin >> transceivers[i].first >> transceivers[i].second;
double l = 0;
double r = 1e18;
double ans = 0;
while (r - l >= 0.0001) {
double mid = l + (r - l) / 2;
// cout << l << ' ' << r << ' ' << mid << '\n';
if (check(mid, transceivers, N, L)) {
r = mid;
ans = mid;
} else {
l = mid;
}
}
printf("%0.7lf\n", ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
332 KB |
Output is correct |
2 |
Correct |
5 ms |
456 KB |
Output is correct |
3 |
Correct |
4 ms |
400 KB |
Output is correct |
4 |
Correct |
6 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
576 KB |
Output is correct |
2 |
Correct |
14 ms |
636 KB |
Output is correct |
3 |
Correct |
14 ms |
620 KB |
Output is correct |
4 |
Correct |
14 ms |
652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
752 KB |
Output is correct |
2 |
Correct |
13 ms |
640 KB |
Output is correct |
3 |
Correct |
12 ms |
620 KB |
Output is correct |
4 |
Correct |
10 ms |
652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
572 KB |
Output is correct |
2 |
Correct |
13 ms |
656 KB |
Output is correct |
3 |
Correct |
11 ms |
620 KB |
Output is correct |
4 |
Correct |
11 ms |
652 KB |
Output is correct |
5 |
Correct |
13 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
209 ms |
4760 KB |
Output is correct |
2 |
Correct |
261 ms |
5916 KB |
Output is correct |
3 |
Correct |
141 ms |
3800 KB |
Output is correct |
4 |
Correct |
223 ms |
5952 KB |
Output is correct |
5 |
Correct |
102 ms |
3464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
4912 KB |
Output is correct |
2 |
Correct |
174 ms |
5460 KB |
Output is correct |
3 |
Correct |
191 ms |
6020 KB |
Output is correct |
4 |
Correct |
187 ms |
6172 KB |
Output is correct |
5 |
Correct |
205 ms |
6604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
240 ms |
5308 KB |
Output is correct |
2 |
Correct |
276 ms |
5004 KB |
Output is correct |
3 |
Correct |
213 ms |
6040 KB |
Output is correct |
4 |
Correct |
235 ms |
7472 KB |
Output is correct |
5 |
Correct |
216 ms |
6328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
318 ms |
5656 KB |
Output is correct |
2 |
Correct |
299 ms |
7012 KB |
Output is correct |
3 |
Correct |
328 ms |
6604 KB |
Output is correct |
4 |
Correct |
235 ms |
7668 KB |
Output is correct |
5 |
Correct |
227 ms |
6808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
371 ms |
5600 KB |
Output is correct |
2 |
Correct |
304 ms |
6988 KB |
Output is correct |
3 |
Correct |
315 ms |
6564 KB |
Output is correct |
4 |
Correct |
260 ms |
7484 KB |
Output is correct |
5 |
Correct |
236 ms |
6988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
24212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
24240 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
35532 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
35588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
38768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
38644 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
41864 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
41724 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1098 ms |
48008 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
15948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |