#include<bits/stdc++.h>
#define prob "mobile"
#define x first
#define y second
using namespace std;
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int n,L;
pair<double,double> p[maxn+5];
int main(){
// freopen(prob".in","r",stdin);
// freopen(prob".out","w",stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n >> L;
for(int i=1;i<=n;i++) cin >> p[i].x >> p[i].y;
auto check = [&](double val) -> int{
vector<pair<double,double>> G;
for(int i=1;i<=n;i++){
// if(val < p[i].y) return 0;
double tmp = sqrt(val*val-p[i].y*p[i].y);
double xL = p[i].x - tmp;
double xR = p[i].x + tmp;
G.push_back(make_pair(xL,xR));
}
sort(G.begin(),G.end(), [](const pair<double,double> A, const pair<double,double> B){
if(A.first == B.first) return A.second < B.second;
return A.first < B.first;
});
double curx = 0;
for(int i=0;i<n;i++){
if(G[i].x <= curx){
curx = max(curx, G[i].y);
}
}
if(curx >= (double)(L)) return 1;
return 0;
};
double low = 1, high = (double)(2e9), res = 0;
for(int i=1;i<=100;i++){
if(high - low < eps) break;
double mid = (low + high) / (double)(2);
if(check(mid)){
res = mid;
high = mid;
}
else{
low = mid;
}
}
cout << fixed << setprecision(4);
cout << res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
17 ms |
660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
680 KB |
Output is correct |
2 |
Correct |
28 ms |
684 KB |
Output is correct |
3 |
Correct |
17 ms |
656 KB |
Output is correct |
4 |
Incorrect |
21 ms |
692 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
367 ms |
5008 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
314 ms |
5000 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
301 ms |
5444 KB |
Output is correct |
2 |
Correct |
636 ms |
5216 KB |
Output is correct |
3 |
Correct |
378 ms |
5196 KB |
Output is correct |
4 |
Incorrect |
596 ms |
5776 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
639 ms |
5656 KB |
Output is correct |
2 |
Correct |
813 ms |
5828 KB |
Output is correct |
3 |
Correct |
446 ms |
5724 KB |
Output is correct |
4 |
Incorrect |
718 ms |
5780 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
343 ms |
5788 KB |
Output is correct |
2 |
Correct |
845 ms |
5728 KB |
Output is correct |
3 |
Correct |
488 ms |
5652 KB |
Output is correct |
4 |
Incorrect |
665 ms |
5780 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1084 ms |
24508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1083 ms |
24376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1049 ms |
35744 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1093 ms |
35856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1059 ms |
38972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1094 ms |
38828 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1076 ms |
42004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
42060 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1095 ms |
48220 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1091 ms |
48036 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |