# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
477083 |
2021-09-30T06:23:26 Z |
qwerty1234 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
49972 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 = bounds[0].second - bounds[0].first;
double right = bounds[0].second;
for (int i = 1; i < (int)bounds.size(); i++) {
double currBound = bounds[i].second - bounds[i].first;
currBound -= max(0.0, right - bounds[i].first);
covered += max(0.0, currBound);
right = max(bounds[i].second, right);
}
return covered >= L;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
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 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
456 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
190 ms |
5484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
200 ms |
5692 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
210 ms |
5760 KB |
Output is correct |
2 |
Incorrect |
208 ms |
5848 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
253 ms |
6376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
257 ms |
6360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
25096 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
25064 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1044 ms |
36400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
36412 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
39588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
39680 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
42652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
42656 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
48956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
49972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |