#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);
map<int,int> minabs;
for (int i = 0; i < N; i++){
cin >> a[i].first >> a[i].second;
if(minabs.find(a[i].first)==minabs.end()) {
minabs[a[i].first]=abs(a[i].second);
}
else {
minabs[a[i].first]=min(minabs[a[i].first],abs(a[i].second));
}
}
double toL=1e10+100;
double toO=1e10+100;
double mxDst=0;
for (int i = 0; i < N; i++)
{
toO=min(dist(0,0,a[i].first,minabs[a[i].first]),toO);
toL=min(dist(L,0,a[i].first,minabs[a[i].first]),toL);
}
mxDst=max(toO,toL);
for (int i = 0; i < N-1; i++)
{
double x1=a[i].first,y1=minabs[a[i].first],x2=a[i+1].first,y2=minabs[a[i+1].first];
if(x1==x2) continue;
else{
double x=(((pow(x2,2)+pow(y2,2))-pow(x1,2))-pow(y1,2))/((((double)2*x2)-(double)2*x1));
if(x>L||x<0) continue;
mxDst=max(min(dist(x2,y2,x,0),dist(x1,y1,x,0)),mxDst);
}
}
cout << setprecision(4) << fixed << (double)mxDst << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
69 ms |
5776 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
41 ms |
1884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
82 ms |
7500 KB |
Output is correct |
2 |
Incorrect |
78 ms |
4948 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
97 ms |
4652 KB |
Output is correct |
2 |
Incorrect |
81 ms |
4688 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
95 ms |
8024 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
489 ms |
39468 KB |
Output is correct |
2 |
Correct |
271 ms |
8824 KB |
Output is correct |
3 |
Correct |
269 ms |
8604 KB |
Output is correct |
4 |
Incorrect |
552 ms |
39380 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
275 ms |
8564 KB |
Output is correct |
2 |
Incorrect |
567 ms |
39136 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
660 ms |
47400 KB |
Output is correct |
2 |
Correct |
317 ms |
10188 KB |
Output is correct |
3 |
Correct |
332 ms |
10196 KB |
Output is correct |
4 |
Incorrect |
714 ms |
47208 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
10068 KB |
Output is correct |
2 |
Incorrect |
722 ms |
47116 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
799 ms |
55084 KB |
Output is correct |
2 |
Correct |
364 ms |
11952 KB |
Output is correct |
3 |
Correct |
363 ms |
11604 KB |
Output is correct |
4 |
Incorrect |
894 ms |
54972 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
376 ms |
12136 KB |
Output is correct |
2 |
Incorrect |
848 ms |
54612 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
904 ms |
63056 KB |
Output is correct |
2 |
Incorrect |
408 ms |
13264 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
424 ms |
13136 KB |
Output is correct |
2 |
Incorrect |
969 ms |
62100 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1020 ms |
78732 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
510 ms |
16208 KB |
Output is correct |
2 |
Execution timed out |
1038 ms |
77508 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |