#include <bits/stdc++.h>
using namespace std;
using pld = pair<double, double>;
using ld = double;
#define mp make_pair
int n;
ld l;
vector<pld> station;
pld intercept(pld coor, ld r)
{
if(abs(coor.second)>r) return mp(-1, -1);
ld mid = pow(r, 2)-pow(coor.second, 2);
ld rt_mid = pow(mid , 0.5);
return mp(coor.first-rt_mid, coor.first+rt_mid);
}
bool check_dist(ld r)
{
if(r<0) return false;
pld ret_int;
ld from_x=0;
/*
auto it=lower_bound(station.begin(), station.end(), mp(-r, -1e9));
while(it<station.end())
{
if((*it).first>from_x+r) return false;
ret_int=intercept(*it, r);
if(ret_int.first<=from_x && ret_int.second>from_x)
{
from_x=ret_int.second;
if(from_x>=l) return true;
it = upper_bound(it+1, station.end(), mp(from_x-r, 1e9));
}
else it++;
}
return false;
*/
for(auto& circ: station)
{
if(circ.first>from_x+r) return false;
if(circ.first>from_x-r)
{
ret_int=intercept(circ, r);
if(ret_int.first<=from_x && ret_int.second>from_x)
{
from_x=ret_int.second;
if(from_x>=l) return true;
}
}
}
return false;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout<<setprecision(20);
cin>>n>>l;
station.resize(n);
ld max_coor{};
for(int i=0; i<n; i++)
{
cin>>station[i].first>>station[i].second;
max_coor=max({abs(station[i].first), abs(station[i].second), max_coor});
}
ld high=2*(max_coor+l);
ld low=0;
ld mid;
while(high-low>=1e-3)
{
mid=(high+low)/2;
if(check_dist(mid)) high=mid;
else low=mid;
}
cout<<high;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
456 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
468 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
48 ms |
2252 KB |
Output is correct |
2 |
Correct |
37 ms |
2524 KB |
Output is correct |
3 |
Correct |
31 ms |
1656 KB |
Output is correct |
4 |
Correct |
49 ms |
2624 KB |
Output is correct |
5 |
Correct |
29 ms |
1476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
37 ms |
2184 KB |
Output is correct |
2 |
Correct |
36 ms |
2180 KB |
Output is correct |
3 |
Correct |
39 ms |
2608 KB |
Output is correct |
4 |
Correct |
49 ms |
2688 KB |
Output is correct |
5 |
Correct |
53 ms |
3088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
105 ms |
2332 KB |
Output is correct |
2 |
Correct |
41 ms |
2748 KB |
Output is correct |
3 |
Correct |
53 ms |
2508 KB |
Output is correct |
4 |
Correct |
62 ms |
3788 KB |
Output is correct |
5 |
Correct |
39 ms |
2600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
3416 KB |
Output is correct |
2 |
Correct |
50 ms |
3276 KB |
Output is correct |
3 |
Correct |
58 ms |
2908 KB |
Output is correct |
4 |
Correct |
62 ms |
3788 KB |
Output is correct |
5 |
Correct |
55 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
3288 KB |
Output is correct |
2 |
Correct |
51 ms |
3284 KB |
Output is correct |
3 |
Correct |
66 ms |
2888 KB |
Output is correct |
4 |
Correct |
63 ms |
3780 KB |
Output is correct |
5 |
Correct |
50 ms |
3148 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
662 ms |
12356 KB |
Output is correct |
2 |
Correct |
257 ms |
15816 KB |
Output is correct |
3 |
Correct |
238 ms |
15312 KB |
Output is correct |
4 |
Correct |
305 ms |
17620 KB |
Output is correct |
5 |
Correct |
260 ms |
14928 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
243 ms |
16336 KB |
Output is correct |
2 |
Correct |
392 ms |
14652 KB |
Output is correct |
3 |
Correct |
298 ms |
13772 KB |
Output is correct |
4 |
Correct |
315 ms |
17340 KB |
Output is correct |
5 |
Correct |
256 ms |
15432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
849 ms |
14816 KB |
Output is correct |
2 |
Correct |
310 ms |
18924 KB |
Output is correct |
3 |
Correct |
295 ms |
18544 KB |
Output is correct |
4 |
Correct |
379 ms |
21600 KB |
Output is correct |
5 |
Correct |
319 ms |
17636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
324 ms |
19544 KB |
Output is correct |
2 |
Correct |
435 ms |
17632 KB |
Output is correct |
3 |
Correct |
411 ms |
16488 KB |
Output is correct |
4 |
Correct |
374 ms |
21336 KB |
Output is correct |
5 |
Correct |
330 ms |
18420 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
952 ms |
17288 KB |
Output is correct |
2 |
Correct |
363 ms |
22024 KB |
Output is correct |
3 |
Correct |
331 ms |
21512 KB |
Output is correct |
4 |
Correct |
424 ms |
24700 KB |
Output is correct |
5 |
Correct |
334 ms |
20300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
365 ms |
22908 KB |
Output is correct |
2 |
Correct |
520 ms |
20428 KB |
Output is correct |
3 |
Correct |
437 ms |
19572 KB |
Output is correct |
4 |
Correct |
477 ms |
24652 KB |
Output is correct |
5 |
Correct |
359 ms |
21364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1083 ms |
19760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
415 ms |
26008 KB |
Output is correct |
2 |
Correct |
623 ms |
23312 KB |
Output is correct |
3 |
Correct |
486 ms |
22292 KB |
Output is correct |
4 |
Correct |
487 ms |
28188 KB |
Output is correct |
5 |
Correct |
414 ms |
24400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
24668 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
518 ms |
32404 KB |
Output is correct |
2 |
Correct |
759 ms |
29152 KB |
Output is correct |
3 |
Correct |
628 ms |
28236 KB |
Output is correct |
4 |
Correct |
633 ms |
17408 KB |
Output is correct |
5 |
Correct |
537 ms |
30676 KB |
Output is correct |