# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
477073 |
2021-09-30T06:05:10 Z |
qwerty1234 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
25092 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 = 1e18;
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 |
0 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 |
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 |
4 ms |
332 KB |
Output is correct |
3 |
Correct |
3 ms |
204 KB |
Output is correct |
4 |
Correct |
4 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
332 KB |
Output is correct |
3 |
Correct |
5 ms |
284 KB |
Output is correct |
4 |
Correct |
7 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
368 KB |
Output is correct |
2 |
Correct |
7 ms |
332 KB |
Output is correct |
3 |
Correct |
6 ms |
332 KB |
Output is correct |
4 |
Correct |
8 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
368 KB |
Output is correct |
2 |
Correct |
7 ms |
332 KB |
Output is correct |
3 |
Correct |
6 ms |
332 KB |
Output is correct |
4 |
Correct |
8 ms |
368 KB |
Output is correct |
5 |
Correct |
5 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
1456 KB |
Output is correct |
2 |
Correct |
102 ms |
1484 KB |
Output is correct |
3 |
Correct |
62 ms |
1100 KB |
Output is correct |
4 |
Correct |
105 ms |
1484 KB |
Output is correct |
5 |
Correct |
48 ms |
1076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
1520 KB |
Output is correct |
2 |
Correct |
82 ms |
1388 KB |
Output is correct |
3 |
Correct |
101 ms |
1484 KB |
Output is correct |
4 |
Correct |
108 ms |
1520 KB |
Output is correct |
5 |
Correct |
131 ms |
1640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
1680 KB |
Output is correct |
2 |
Correct |
109 ms |
1568 KB |
Output is correct |
3 |
Correct |
95 ms |
1612 KB |
Output is correct |
4 |
Correct |
150 ms |
1740 KB |
Output is correct |
5 |
Correct |
103 ms |
1672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
1852 KB |
Output is correct |
2 |
Correct |
139 ms |
1844 KB |
Output is correct |
3 |
Correct |
131 ms |
1740 KB |
Output is correct |
4 |
Correct |
155 ms |
1860 KB |
Output is correct |
5 |
Correct |
123 ms |
1740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
1740 KB |
Output is correct |
2 |
Correct |
140 ms |
1848 KB |
Output is correct |
3 |
Correct |
131 ms |
1852 KB |
Output is correct |
4 |
Correct |
158 ms |
1740 KB |
Output is correct |
5 |
Correct |
124 ms |
1860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
583 ms |
8112 KB |
Output is correct |
2 |
Correct |
733 ms |
8012 KB |
Output is correct |
3 |
Correct |
685 ms |
15272 KB |
Output is correct |
4 |
Correct |
774 ms |
17564 KB |
Output is correct |
5 |
Correct |
639 ms |
14916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
758 ms |
8012 KB |
Output is correct |
2 |
Correct |
723 ms |
14708 KB |
Output is correct |
3 |
Correct |
590 ms |
13852 KB |
Output is correct |
4 |
Correct |
761 ms |
17440 KB |
Output is correct |
5 |
Correct |
656 ms |
15408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
632 ms |
9676 KB |
Output is correct |
2 |
Correct |
855 ms |
18952 KB |
Output is correct |
3 |
Correct |
804 ms |
18232 KB |
Output is correct |
4 |
Correct |
946 ms |
21552 KB |
Output is correct |
5 |
Correct |
815 ms |
17596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
889 ms |
9676 KB |
Output is correct |
2 |
Correct |
832 ms |
17592 KB |
Output is correct |
3 |
Correct |
711 ms |
16444 KB |
Output is correct |
4 |
Correct |
956 ms |
21304 KB |
Output is correct |
5 |
Correct |
822 ms |
18368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
785 ms |
11244 KB |
Output is correct |
2 |
Execution timed out |
1004 ms |
22072 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1026 ms |
11248 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
870 ms |
12748 KB |
Output is correct |
2 |
Execution timed out |
1085 ms |
25092 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
12748 KB |
Time limit exceeded |
2 |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
15948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |