#include <bits/stdc++.h>
#define sz(x) (int)(x.size())
using namespace std;
int n, L;
vector<pair<double, double>> a;
void solve() {
cin >> n >> L;
a.clear();
for (int i=0; i<n; i++) {
int x, y; cin >> x >> y;
if (!a.empty() && x==a.back().first) {
if (abs(y)<abs(a.back().second)) a.back().second=y;
continue;
}
a.push_back({x, y});
}
n=sz(a);
double l=0, r=1e9;
while (r-l>=0.001) {
double mid=(l+r)/2;
double borne=0;
for (int i=0; i<n; i++) {
if (abs(a[i].second)>mid) continue;
double x=a[i].first, y=a[i].second;
double dist=sqrt(pow(mid, 2)-pow(y, 2));
if (x-dist<=borne && x+dist>borne) borne=x+dist;
}
if (borne>=L) r=mid;
else l=mid;
}
cout << fixed << setprecision(3) << l << endl;
return;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
500 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 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 |
600 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2520 KB |
Output is correct |
2 |
Correct |
17 ms |
1500 KB |
Output is correct |
3 |
Correct |
12 ms |
1480 KB |
Output is correct |
4 |
Correct |
17 ms |
2516 KB |
Output is correct |
5 |
Correct |
5 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
2520 KB |
Output is correct |
2 |
Correct |
18 ms |
1500 KB |
Output is correct |
3 |
Correct |
19 ms |
2520 KB |
Output is correct |
4 |
Correct |
23 ms |
2452 KB |
Output is correct |
5 |
Correct |
13 ms |
988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
1500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
2520 KB |
Output is correct |
2 |
Correct |
18 ms |
1500 KB |
Output is correct |
3 |
Incorrect |
14 ms |
760 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
114 ms |
8652 KB |
Output is correct |
2 |
Correct |
69 ms |
772 KB |
Output is correct |
3 |
Correct |
64 ms |
824 KB |
Output is correct |
4 |
Incorrect |
108 ms |
9156 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
69 ms |
680 KB |
Output is correct |
2 |
Correct |
168 ms |
10692 KB |
Output is correct |
3 |
Correct |
74 ms |
2636 KB |
Output is correct |
4 |
Correct |
109 ms |
10192 KB |
Output is correct |
5 |
Correct |
103 ms |
9924 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
142 ms |
17588 KB |
Output is correct |
2 |
Correct |
77 ms |
636 KB |
Output is correct |
3 |
Correct |
76 ms |
548 KB |
Output is correct |
4 |
Correct |
146 ms |
17872 KB |
Output is correct |
5 |
Correct |
115 ms |
9028 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
656 KB |
Output is correct |
2 |
Correct |
187 ms |
17588 KB |
Output is correct |
3 |
Correct |
75 ms |
2512 KB |
Output is correct |
4 |
Correct |
137 ms |
18420 KB |
Output is correct |
5 |
Correct |
138 ms |
18612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
167 ms |
17848 KB |
Output is correct |
2 |
Correct |
92 ms |
748 KB |
Output is correct |
3 |
Correct |
92 ms |
460 KB |
Output is correct |
4 |
Incorrect |
167 ms |
17076 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
93 ms |
596 KB |
Output is correct |
2 |
Incorrect |
212 ms |
18100 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
193 ms |
18640 KB |
Output is correct |
2 |
Incorrect |
106 ms |
632 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
108 ms |
900 KB |
Output is correct |
2 |
Correct |
235 ms |
17452 KB |
Output is correct |
3 |
Correct |
105 ms |
2500 KB |
Output is correct |
4 |
Correct |
200 ms |
17336 KB |
Output is correct |
5 |
Correct |
160 ms |
17500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
232 ms |
17076 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
131 ms |
592 KB |
Output is correct |
2 |
Correct |
294 ms |
17592 KB |
Output is correct |
3 |
Correct |
132 ms |
4716 KB |
Output is correct |
4 |
Correct |
227 ms |
18408 KB |
Output is correct |
5 |
Correct |
241 ms |
17492 KB |
Output is correct |