#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
#define all(x) x.begin(), x.end()
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(NULL);
int N;
double L;
cin >> N >> L;
vector<double> X(N);
vector<double> Y(N);
for (int i=0;i<N;i++) cin >> X[i] >> Y[i];
auto get_hw = [&](double y, double r) {
if (abs(y) >= r) return -1.0;
return sqrt(r*r - y*y);
};
auto can_do = [&](double R) {
vector<pair<double, double>> ivals;
for (int i=0;i<N;i++) {
double hw = get_hw(Y[i], R);
if (hw < 0) continue;
ivals.push_back({X[i] - hw, X[i] + hw});
}
sort(all(ivals));
double progress = 0.;
for (auto [l, r] : ivals) {
if (l > progress) return false;
progress = max(progress, r);
}
return progress >= L;
};
double lo = 0;
double hi = L + abs(X[0]) + abs(Y[0]);
while (hi - lo > 1e-4) {
double mid = (lo + hi) / 2;
if (can_do(mid)) hi = mid;
else lo = mid;
}
cout << setprecision(10);
cout << lo << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
476 KB |
Output is correct |
4 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
604 KB |
Output is correct |
2 |
Correct |
6 ms |
956 KB |
Output is correct |
3 |
Correct |
7 ms |
712 KB |
Output is correct |
4 |
Correct |
3 ms |
720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
600 KB |
Output is correct |
2 |
Correct |
7 ms |
812 KB |
Output is correct |
3 |
Correct |
7 ms |
724 KB |
Output is correct |
4 |
Correct |
4 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
792 KB |
Output is correct |
2 |
Correct |
7 ms |
816 KB |
Output is correct |
3 |
Correct |
9 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
71 ms |
5688 KB |
Output is correct |
2 |
Correct |
193 ms |
5992 KB |
Output is correct |
3 |
Correct |
105 ms |
3588 KB |
Output is correct |
4 |
Correct |
42 ms |
4824 KB |
Output is correct |
5 |
Correct |
22 ms |
3016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
4556 KB |
Output is correct |
2 |
Correct |
36 ms |
4568 KB |
Output is correct |
3 |
Correct |
40 ms |
4824 KB |
Output is correct |
4 |
Correct |
42 ms |
5072 KB |
Output is correct |
5 |
Correct |
47 ms |
5384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
105 ms |
5992 KB |
Output is correct |
2 |
Correct |
214 ms |
6280 KB |
Output is correct |
3 |
Correct |
242 ms |
5788 KB |
Output is correct |
4 |
Incorrect |
56 ms |
6092 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
224 ms |
7232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
156 ms |
7260 KB |
Output is correct |
2 |
Correct |
274 ms |
7240 KB |
Output is correct |
3 |
Correct |
297 ms |
6284 KB |
Output is correct |
4 |
Incorrect |
55 ms |
6056 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
800 ms |
28696 KB |
Output is correct |
2 |
Execution timed out |
1052 ms |
32064 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1020 ms |
32532 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1053 ms |
40992 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1050 ms |
45708 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1031 ms |
44896 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1046 ms |
50384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1059 ms |
48924 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1049 ms |
55416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1024 ms |
56940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1049 ms |
64772 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |