#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)
{
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(11);
cin>>n>>l;
station.resize(n);
for(int i=0; i<n; i++)
{
cin>>station[i].first>>station[i].second;
}
ld high=2e9;
ld low=0;
ld mid;
while(high-low>=1e-4)
{
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 |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
5 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
452 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
2248 KB |
Output is correct |
2 |
Correct |
38 ms |
2228 KB |
Output is correct |
3 |
Correct |
34 ms |
1672 KB |
Output is correct |
4 |
Correct |
41 ms |
2632 KB |
Output is correct |
5 |
Correct |
20 ms |
1492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
2184 KB |
Output is correct |
2 |
Correct |
33 ms |
2140 KB |
Output is correct |
3 |
Correct |
40 ms |
2288 KB |
Output is correct |
4 |
Correct |
45 ms |
2244 KB |
Output is correct |
5 |
Correct |
51 ms |
2368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
160 ms |
2320 KB |
Output is correct |
2 |
Correct |
40 ms |
2368 KB |
Output is correct |
3 |
Correct |
50 ms |
2396 KB |
Output is correct |
4 |
Correct |
60 ms |
3788 KB |
Output is correct |
5 |
Correct |
43 ms |
2588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
2764 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
127 ms |
2664 KB |
Output is correct |
2 |
Correct |
50 ms |
2564 KB |
Output is correct |
3 |
Correct |
66 ms |
2584 KB |
Output is correct |
4 |
Correct |
64 ms |
3796 KB |
Output is correct |
5 |
Correct |
51 ms |
3028 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1055 ms |
9036 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
265 ms |
9860 KB |
Output is correct |
2 |
Correct |
437 ms |
9232 KB |
Output is correct |
3 |
Correct |
314 ms |
13904 KB |
Output is correct |
4 |
Correct |
290 ms |
17488 KB |
Output is correct |
5 |
Correct |
252 ms |
15444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1030 ms |
10796 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
297 ms |
11468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1033 ms |
12100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
356 ms |
13080 KB |
Output is correct |
2 |
Correct |
577 ms |
12220 KB |
Output is correct |
3 |
Correct |
444 ms |
19576 KB |
Output is correct |
4 |
Correct |
449 ms |
24572 KB |
Output is correct |
5 |
Correct |
352 ms |
21388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1010 ms |
14252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
388 ms |
14608 KB |
Output is correct |
2 |
Correct |
697 ms |
13796 KB |
Output is correct |
3 |
Correct |
504 ms |
22348 KB |
Output is correct |
4 |
Correct |
488 ms |
28212 KB |
Output is correct |
5 |
Correct |
406 ms |
24396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
17712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
501 ms |
17600 KB |
Output is correct |
2 |
Correct |
853 ms |
16956 KB |
Output is correct |
3 |
Correct |
631 ms |
28256 KB |
Output is correct |
4 |
Correct |
584 ms |
35328 KB |
Output is correct |
5 |
Correct |
511 ms |
30708 KB |
Output is correct |