#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());
if(r == 5.0) {
for(int32_t i = 0; i < 2 * n; i++) {
std::cout << " " << events[i].first << " " << events[i].second << '\n';
}
}
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;
}
}
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';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
448 KB |
Output is correct |
2 |
Correct |
3 ms |
528 KB |
Output is correct |
3 |
Incorrect |
3 ms |
528 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
796 KB |
Output is correct |
2 |
Incorrect |
20 ms |
800 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
996 KB |
Output is correct |
2 |
Correct |
40 ms |
1000 KB |
Output is correct |
3 |
Correct |
42 ms |
1000 KB |
Output is correct |
4 |
Correct |
41 ms |
1060 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
1060 KB |
Output is correct |
2 |
Correct |
40 ms |
1060 KB |
Output is correct |
3 |
Correct |
43 ms |
1060 KB |
Output is correct |
4 |
Correct |
41 ms |
1060 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
41 ms |
1060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
638 ms |
5912 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
775 ms |
6144 KB |
Output is correct |
2 |
Correct |
691 ms |
6144 KB |
Output is correct |
3 |
Correct |
788 ms |
6600 KB |
Output is correct |
4 |
Correct |
783 ms |
6600 KB |
Output is correct |
5 |
Correct |
827 ms |
6984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
981 ms |
7068 KB |
Output is correct |
2 |
Correct |
955 ms |
7092 KB |
Output is correct |
3 |
Incorrect |
894 ms |
8216 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1016 ms |
9216 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
808 ms |
9296 KB |
Output is correct |
2 |
Execution timed out |
1049 ms |
10704 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1066 ms |
38836 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1078 ms |
38912 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1054 ms |
45932 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1063 ms |
45972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1062 ms |
52980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1056 ms |
52980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1070 ms |
60044 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1070 ms |
60048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1075 ms |
74296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1067 ms |
74296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |