# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
477072 |
2021-09-30T06:01:35 Z |
qwerty1234 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
48136 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 = 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 |
0 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 |
4 ms |
332 KB |
Output is correct |
2 |
Correct |
4 ms |
332 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
4 |
Correct |
5 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
572 KB |
Output is correct |
2 |
Correct |
10 ms |
572 KB |
Output is correct |
3 |
Correct |
8 ms |
588 KB |
Output is correct |
4 |
Correct |
8 ms |
572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
588 KB |
Output is correct |
2 |
Correct |
10 ms |
580 KB |
Output is correct |
3 |
Correct |
8 ms |
572 KB |
Output is correct |
4 |
Correct |
7 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
576 KB |
Output is correct |
2 |
Correct |
10 ms |
572 KB |
Output is correct |
3 |
Correct |
7 ms |
580 KB |
Output is correct |
4 |
Correct |
8 ms |
572 KB |
Output is correct |
5 |
Correct |
7 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
129 ms |
4836 KB |
Output is correct |
2 |
Correct |
175 ms |
4824 KB |
Output is correct |
3 |
Correct |
98 ms |
2988 KB |
Output is correct |
4 |
Correct |
118 ms |
4744 KB |
Output is correct |
5 |
Correct |
71 ms |
2924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
114 ms |
4980 KB |
Output is correct |
2 |
Correct |
106 ms |
4600 KB |
Output is correct |
3 |
Correct |
116 ms |
4888 KB |
Output is correct |
4 |
Correct |
118 ms |
4836 KB |
Output is correct |
5 |
Correct |
129 ms |
5056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
155 ms |
5160 KB |
Output is correct |
2 |
Correct |
180 ms |
5060 KB |
Output is correct |
3 |
Correct |
138 ms |
5044 KB |
Output is correct |
4 |
Correct |
153 ms |
5404 KB |
Output is correct |
5 |
Correct |
130 ms |
5228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
214 ms |
5564 KB |
Output is correct |
2 |
Correct |
212 ms |
5548 KB |
Output is correct |
3 |
Correct |
175 ms |
5528 KB |
Output is correct |
4 |
Correct |
155 ms |
5388 KB |
Output is correct |
5 |
Correct |
145 ms |
5528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
218 ms |
5580 KB |
Output is correct |
2 |
Correct |
201 ms |
5592 KB |
Output is correct |
3 |
Correct |
182 ms |
5548 KB |
Output is correct |
4 |
Correct |
152 ms |
5388 KB |
Output is correct |
5 |
Correct |
146 ms |
5524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
943 ms |
24340 KB |
Output is correct |
2 |
Execution timed out |
1092 ms |
31920 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
24224 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
35700 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
35536 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1064 ms |
38696 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
38676 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
41840 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
41728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
48136 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
15948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |