#include <bits/stdc++.h>
const int32_t MAX_N = 1e6;
const double EPS = 1e-6;
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++) {
if(r * r < (int64_t) points[i].second * points[i].second) {
events[2 * i] = { -2.0, 0 };
events[2 * i + 1] = { -1.0, 1 };
continue;
}
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);
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.0) && currCnt == 0) {
return false;
}
}
if(events.back().first < 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 / 10000.0)) {
ans = mid / 10000.0;
high = mid - 1;
}
else {
low = mid + 1;
}
}
std::cout << std::fixed << std::setprecision(7);
std::cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
388 KB |
Output is correct |
3 |
Correct |
2 ms |
432 KB |
Output is correct |
4 |
Correct |
2 ms |
480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
528 KB |
Output is correct |
2 |
Correct |
3 ms |
580 KB |
Output is correct |
3 |
Correct |
3 ms |
584 KB |
Output is correct |
4 |
Correct |
2 ms |
588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
820 KB |
Output is correct |
2 |
Correct |
18 ms |
940 KB |
Output is correct |
3 |
Correct |
16 ms |
992 KB |
Output is correct |
4 |
Correct |
17 ms |
1184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
1284 KB |
Output is correct |
2 |
Correct |
42 ms |
1384 KB |
Output is correct |
3 |
Correct |
42 ms |
1396 KB |
Output is correct |
4 |
Correct |
42 ms |
1500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
1532 KB |
Output is correct |
2 |
Correct |
41 ms |
1728 KB |
Output is correct |
3 |
Correct |
42 ms |
1728 KB |
Output is correct |
4 |
Correct |
42 ms |
1848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
1848 KB |
Output is correct |
2 |
Correct |
40 ms |
1848 KB |
Output is correct |
3 |
Correct |
43 ms |
1876 KB |
Output is correct |
4 |
Correct |
41 ms |
1948 KB |
Output is correct |
5 |
Correct |
41 ms |
2016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
756 ms |
7728 KB |
Output is correct |
2 |
Correct |
846 ms |
8940 KB |
Output is correct |
3 |
Correct |
473 ms |
8940 KB |
Output is correct |
4 |
Correct |
732 ms |
10680 KB |
Output is correct |
5 |
Correct |
482 ms |
10680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
780 ms |
11760 KB |
Output is correct |
2 |
Correct |
695 ms |
12044 KB |
Output is correct |
3 |
Correct |
798 ms |
13844 KB |
Output is correct |
4 |
Correct |
768 ms |
14868 KB |
Output is correct |
5 |
Correct |
801 ms |
16880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
958 ms |
17616 KB |
Output is correct |
2 |
Correct |
922 ms |
18268 KB |
Output is correct |
3 |
Correct |
893 ms |
19368 KB |
Output is correct |
4 |
Correct |
883 ms |
22344 KB |
Output is correct |
5 |
Correct |
884 ms |
22524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1081 ms |
24816 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
773 ms |
26368 KB |
Output is correct |
2 |
Execution timed out |
1058 ms |
27756 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1053 ms |
57376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1046 ms |
57412 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1102 ms |
64408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1070 ms |
64408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1075 ms |
74548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1063 ms |
84468 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1051 ms |
91556 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1074 ms |
91576 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1056 ms |
105652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1055 ms |
105652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |