#include <bits/stdc++.h>
using namespace std;
#define int double
double dist(double x1, double y1, double x2, double y2){
double dist=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
return dist;
}
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int N,L; cin >> N >> L;
vector<pair<double,double>> a(N);
for (int i = 0; i < N; i++){
cin >> a[i].first >> a[i].second;
a[i].second=abs(a[i].second);
}
int l=0,r=L;
int ans;
while(r-l>0.0003){
int mid=(l+r)/2;
int rght=0;
for (int i = 0; i < N; i++)
{
int pnt1=a[i].first-sqrt(pow(mid,2)-pow(a[i].second,2)),pnt2=a[i].first+sqrt(pow(mid,2)-pow(a[i].second,2));
if(mid>=a[i].second){
if(pnt1<=rght) rght=max(rght, pnt2);
}
}
if(rght>=L) {
r=mid;
ans=r;
}else{
l=mid;
}
}
cout << setprecision(5) << fixed << (double)ans << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 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 |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
4 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
596 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
4 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
1628 KB |
Output is correct |
2 |
Correct |
36 ms |
1628 KB |
Output is correct |
3 |
Correct |
25 ms |
1112 KB |
Output is correct |
4 |
Correct |
54 ms |
1628 KB |
Output is correct |
5 |
Correct |
25 ms |
1112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
1624 KB |
Output is correct |
2 |
Correct |
42 ms |
1372 KB |
Output is correct |
3 |
Correct |
53 ms |
1880 KB |
Output is correct |
4 |
Correct |
54 ms |
1628 KB |
Output is correct |
5 |
Correct |
63 ms |
1628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
1624 KB |
Output is correct |
2 |
Correct |
40 ms |
1628 KB |
Output is correct |
3 |
Correct |
39 ms |
1880 KB |
Output is correct |
4 |
Correct |
79 ms |
1880 KB |
Output is correct |
5 |
Correct |
51 ms |
1628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
1880 KB |
Output is correct |
2 |
Correct |
59 ms |
1884 KB |
Output is correct |
3 |
Correct |
52 ms |
1880 KB |
Output is correct |
4 |
Correct |
78 ms |
1884 KB |
Output is correct |
5 |
Correct |
66 ms |
1884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
1884 KB |
Output is correct |
2 |
Correct |
48 ms |
1880 KB |
Output is correct |
3 |
Correct |
45 ms |
1880 KB |
Output is correct |
4 |
Correct |
80 ms |
1880 KB |
Output is correct |
5 |
Correct |
68 ms |
1884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
240 ms |
8280 KB |
Output is correct |
2 |
Correct |
241 ms |
8284 KB |
Output is correct |
3 |
Correct |
226 ms |
8280 KB |
Output is correct |
4 |
Correct |
388 ms |
8284 KB |
Output is correct |
5 |
Correct |
320 ms |
8284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
251 ms |
8284 KB |
Output is correct |
2 |
Correct |
354 ms |
8280 KB |
Output is correct |
3 |
Correct |
233 ms |
8280 KB |
Output is correct |
4 |
Correct |
376 ms |
8284 KB |
Output is correct |
5 |
Correct |
341 ms |
8284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
275 ms |
9816 KB |
Output is correct |
2 |
Correct |
301 ms |
9820 KB |
Output is correct |
3 |
Correct |
270 ms |
9820 KB |
Output is correct |
4 |
Correct |
483 ms |
9820 KB |
Output is correct |
5 |
Correct |
378 ms |
9816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
308 ms |
9820 KB |
Output is correct |
2 |
Correct |
424 ms |
9816 KB |
Output is correct |
3 |
Correct |
291 ms |
9820 KB |
Output is correct |
4 |
Correct |
464 ms |
9816 KB |
Output is correct |
5 |
Correct |
398 ms |
9816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
326 ms |
11356 KB |
Output is correct |
2 |
Correct |
357 ms |
11356 KB |
Output is correct |
3 |
Correct |
321 ms |
11352 KB |
Output is correct |
4 |
Correct |
580 ms |
11352 KB |
Output is correct |
5 |
Correct |
457 ms |
11356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
353 ms |
11352 KB |
Output is correct |
2 |
Correct |
490 ms |
11352 KB |
Output is correct |
3 |
Correct |
347 ms |
11352 KB |
Output is correct |
4 |
Correct |
546 ms |
11356 KB |
Output is correct |
5 |
Correct |
487 ms |
11352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
374 ms |
12888 KB |
Output is correct |
2 |
Correct |
384 ms |
12892 KB |
Output is correct |
3 |
Correct |
390 ms |
12888 KB |
Output is correct |
4 |
Correct |
632 ms |
12888 KB |
Output is correct |
5 |
Correct |
512 ms |
12888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
425 ms |
12888 KB |
Output is correct |
2 |
Correct |
556 ms |
12888 KB |
Output is correct |
3 |
Correct |
379 ms |
12888 KB |
Output is correct |
4 |
Correct |
637 ms |
12888 KB |
Output is correct |
5 |
Correct |
926 ms |
12892 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
483 ms |
15964 KB |
Output is correct |
2 |
Correct |
494 ms |
15964 KB |
Output is correct |
3 |
Correct |
469 ms |
15964 KB |
Output is correct |
4 |
Correct |
776 ms |
15960 KB |
Output is correct |
5 |
Correct |
669 ms |
15960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
498 ms |
15960 KB |
Output is correct |
2 |
Correct |
684 ms |
16116 KB |
Output is correct |
3 |
Correct |
480 ms |
15960 KB |
Output is correct |
4 |
Correct |
789 ms |
15960 KB |
Output is correct |
5 |
Correct |
688 ms |
15960 KB |
Output is correct |