#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)
{
ld mid = pow(r, 2)-pow(coor.second, 2);
if(mid<0) return mp(-1, -1);
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;
}
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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
332 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 |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
444 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 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 |
62 ms |
2120 KB |
Output is correct |
2 |
Correct |
38 ms |
2380 KB |
Output is correct |
3 |
Correct |
31 ms |
1672 KB |
Output is correct |
4 |
Correct |
41 ms |
2088 KB |
Output is correct |
5 |
Correct |
20 ms |
1492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
2076 KB |
Output is correct |
2 |
Correct |
34 ms |
2088 KB |
Output is correct |
3 |
Correct |
40 ms |
2360 KB |
Output is correct |
4 |
Correct |
42 ms |
2508 KB |
Output is correct |
5 |
Correct |
51 ms |
2880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
143 ms |
2292 KB |
Output is correct |
2 |
Correct |
43 ms |
2540 KB |
Output is correct |
3 |
Correct |
51 ms |
2424 KB |
Output is correct |
4 |
Correct |
63 ms |
2448 KB |
Output is correct |
5 |
Correct |
39 ms |
2380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
3104 KB |
Output is correct |
2 |
Correct |
46 ms |
3280 KB |
Output is correct |
3 |
Correct |
53 ms |
2904 KB |
Output is correct |
4 |
Correct |
62 ms |
3788 KB |
Output is correct |
5 |
Correct |
46 ms |
3012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
114 ms |
3008 KB |
Output is correct |
2 |
Correct |
47 ms |
3108 KB |
Output is correct |
3 |
Correct |
60 ms |
2764 KB |
Output is correct |
4 |
Correct |
60 ms |
2456 KB |
Output is correct |
5 |
Correct |
48 ms |
2508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1032 ms |
9380 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
257 ms |
10020 KB |
Output is correct |
2 |
Correct |
456 ms |
9412 KB |
Output is correct |
3 |
Correct |
285 ms |
9200 KB |
Output is correct |
4 |
Correct |
286 ms |
9224 KB |
Output is correct |
5 |
Correct |
248 ms |
9292 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1018 ms |
11044 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
303 ms |
11680 KB |
Output is correct |
2 |
Correct |
498 ms |
11536 KB |
Output is correct |
3 |
Correct |
350 ms |
11608 KB |
Output is correct |
4 |
Correct |
363 ms |
11152 KB |
Output is correct |
5 |
Correct |
304 ms |
11608 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1030 ms |
12840 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
352 ms |
13304 KB |
Output is correct |
2 |
Correct |
581 ms |
12524 KB |
Output is correct |
3 |
Correct |
414 ms |
12364 KB |
Output is correct |
4 |
Correct |
416 ms |
12364 KB |
Output is correct |
5 |
Correct |
343 ms |
12360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1050 ms |
14348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
399 ms |
14944 KB |
Output is correct |
2 |
Correct |
711 ms |
14236 KB |
Output is correct |
3 |
Correct |
468 ms |
13896 KB |
Output is correct |
4 |
Correct |
461 ms |
13864 KB |
Output is correct |
5 |
Correct |
389 ms |
13884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1087 ms |
18040 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
506 ms |
18012 KB |
Output is correct |
2 |
Correct |
870 ms |
17356 KB |
Output is correct |
3 |
Correct |
591 ms |
17012 KB |
Output is correct |
4 |
Correct |
579 ms |
15944 KB |
Output is correct |
5 |
Correct |
496 ms |
17048 KB |
Output is correct |