# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
477076 |
2021-09-30T06:08:12 Z |
qwerty1234 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
30272 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;
double covered = 0;
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);
if (transceivers[i].first - x <= covered) {
covered = max(covered, transceivers[i].first + x);
}
// bounds.push_back({ max(transceivers[i].first - x, 0.0), min(transceivers[i].first + x, (double)L) });
}
// if (bounds.size() == 0) {
// return false;
// }
// 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 = 1e9;
double ans = 0;
while (r - l >= 0.001) {
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 |
204 KB |
Output is correct |
4 |
Correct |
0 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 |
3 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
4 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
368 KB |
Output is correct |
3 |
Correct |
5 ms |
368 KB |
Output is correct |
4 |
Correct |
7 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
460 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Correct |
7 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
332 KB |
Output is correct |
2 |
Correct |
6 ms |
368 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Correct |
8 ms |
332 KB |
Output is correct |
5 |
Correct |
5 ms |
368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
1356 KB |
Output is correct |
2 |
Correct |
100 ms |
1484 KB |
Output is correct |
3 |
Correct |
62 ms |
1100 KB |
Output is correct |
4 |
Correct |
98 ms |
1484 KB |
Output is correct |
5 |
Correct |
45 ms |
1060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
1524 KB |
Output is correct |
2 |
Correct |
81 ms |
1380 KB |
Output is correct |
3 |
Correct |
93 ms |
1484 KB |
Output is correct |
4 |
Correct |
103 ms |
1468 KB |
Output is correct |
5 |
Correct |
124 ms |
1636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
88 ms |
1660 KB |
Output is correct |
2 |
Correct |
110 ms |
1568 KB |
Output is correct |
3 |
Correct |
92 ms |
1612 KB |
Output is correct |
4 |
Correct |
142 ms |
1740 KB |
Output is correct |
5 |
Correct |
95 ms |
1612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
132 ms |
1740 KB |
Output is correct |
2 |
Correct |
130 ms |
1844 KB |
Output is correct |
3 |
Correct |
107 ms |
1844 KB |
Output is correct |
4 |
Correct |
151 ms |
1920 KB |
Output is correct |
5 |
Correct |
115 ms |
1848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
129 ms |
1848 KB |
Output is correct |
2 |
Correct |
124 ms |
1740 KB |
Output is correct |
3 |
Correct |
106 ms |
1852 KB |
Output is correct |
4 |
Correct |
146 ms |
1740 KB |
Output is correct |
5 |
Correct |
114 ms |
1740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
512 ms |
8112 KB |
Output is correct |
2 |
Correct |
658 ms |
8132 KB |
Output is correct |
3 |
Correct |
641 ms |
8012 KB |
Output is correct |
4 |
Correct |
721 ms |
8116 KB |
Output is correct |
5 |
Correct |
595 ms |
8132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
674 ms |
8108 KB |
Output is correct |
2 |
Correct |
656 ms |
8108 KB |
Output is correct |
3 |
Correct |
533 ms |
8108 KB |
Output is correct |
4 |
Correct |
709 ms |
8132 KB |
Output is correct |
5 |
Correct |
634 ms |
8108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
580 ms |
9800 KB |
Output is correct |
2 |
Correct |
772 ms |
9676 KB |
Output is correct |
3 |
Correct |
768 ms |
9676 KB |
Output is correct |
4 |
Correct |
901 ms |
9684 KB |
Output is correct |
5 |
Correct |
709 ms |
9676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
808 ms |
9676 KB |
Output is correct |
2 |
Correct |
777 ms |
9676 KB |
Output is correct |
3 |
Correct |
663 ms |
9676 KB |
Output is correct |
4 |
Correct |
888 ms |
9688 KB |
Output is correct |
5 |
Correct |
757 ms |
9676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
680 ms |
11244 KB |
Output is correct |
2 |
Correct |
923 ms |
11332 KB |
Output is correct |
3 |
Correct |
897 ms |
21468 KB |
Output is correct |
4 |
Execution timed out |
1050 ms |
24664 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
943 ms |
11332 KB |
Output is correct |
2 |
Correct |
922 ms |
20436 KB |
Output is correct |
3 |
Correct |
786 ms |
19544 KB |
Output is correct |
4 |
Execution timed out |
1054 ms |
24536 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
794 ms |
12804 KB |
Output is correct |
2 |
Execution timed out |
1043 ms |
12808 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
12808 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
991 ms |
15948 KB |
Output is correct |
2 |
Execution timed out |
1092 ms |
30272 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
15948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |