#include <bits/stdc++.h>
const int32_t MAX_N = 1e6;
int32_t n, l;
std::pair< int32_t, int32_t > points[MAX_N + 5];
bool Check(long double r) {
std::vector< std::pair< long double, bool > > events(2 * n);
for(int32_t i = 0; i < n; i++) {
long double x1 = points[i].first - sqrt(r * r - (int64_t) points[i].second * points[i].second);
long double x2 = points[i].first + sqrt(r * r - (int64_t) points[i].second * points[i].second);
if(x1 > x2) {
std::swap(x1, x2);
}
events[2 * i] = { x1, 0 };
events[2 * i + 1] = { x2, 1 };
}
std::sort(events.begin(), events.end());
int32_t currCnt = 0;
for(int32_t i = 0; i < 2 * n; i++) {
if(events[i].first > 0 && currCnt == 0) {
return false;
}
if(events[i].first > l) {
break;
}
if(events[i].second == 0) {
currCnt++;
}
else {
currCnt--;
}
if(!(events[i].first < 0) && currCnt == 0) {
return false;
}
}
return true;
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cin >> n >> l;
for(int32_t i = 0; i < n; i++) {
std::cin >> points[i].first >> points[i].second;
}
int64_t low = 1, high = 1e12;
long double ans;
while(low <= high) {
int64_t mid = (low + high) / 2;
if(Check(mid / 1000.0)) {
ans = mid / 1000.0;
high = mid - 1;
}
else {
low = mid + 1;
}
}
std::cout << std::fixed << std::setprecision(7);
std::cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
844 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
908 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
42 ms |
940 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
944 KB |
Output is correct |
2 |
Correct |
40 ms |
944 KB |
Output is correct |
3 |
Correct |
45 ms |
944 KB |
Output is correct |
4 |
Incorrect |
41 ms |
1140 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
703 ms |
5984 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
789 ms |
6296 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
963 ms |
6992 KB |
Output is correct |
2 |
Correct |
943 ms |
6992 KB |
Output is correct |
3 |
Incorrect |
970 ms |
6992 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1057 ms |
7796 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
775 ms |
7796 KB |
Output is correct |
2 |
Execution timed out |
1083 ms |
7796 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
36056 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
36056 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
43152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1051 ms |
43156 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
50132 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1058 ms |
50132 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1067 ms |
57252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
57252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1066 ms |
71176 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
71236 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |