#include <bits/stdc++.h>
#define PB push_back
#define MP makepair
#ifndef ONLINE_JUDGE
#define DEBUG(x) cout << #x << " = " << (x) << endl
#else
#define DEBUG(x)
#endif
#define FOR(n) for(int i = 0; i < (n); i++)
#define SORTA(v) sort((v).begin(), (v).end())
#define SORTD(v) sort((v).rbegin(), (v).rend())
#define PRINT(v) for(auto x: (v))cout << x << " "; cout << endl;
#define TWO(n) (1 << (n))
#define INPUT(v) for(auto &x : (v))cin >> x;
#pragma GCC optimize("Ofast,no-stack-protector",3)
typedef long long ll;
using namespace std;
vector<pair<double,double>> torri;
ll n,L;
bool good(double r){
queue<pair<double,double>> s;
for(auto a:torri){
double x = a.first, y = a.second;
if(r*r >= y*y)s.push({max(0.0,x-sqrt(r*r-y*y)),min((double)L,x+sqrt(r*r-y*y))});
}
double curr = 0;
while(!s.empty()){
auto seg = s.front();
s.pop();
if(seg.first <= curr){
curr = seg.second;
}
else return false;
}
if(curr < L)return false;
return true;
}
void solve(){
cin >> n >> L;
torri = vector<pair<double,double>>(n);
for(int i = 0; i < n; i++){
cin >> torri[i].first >> torri[i].second;
}
double l = 0, r = 20e9;
double ans = r;
while(r-l >= 0.00001){
double c = (l + (r-l)/2);
//cout << c << endl;
if(good(c)){
ans = min(ans,c);
r = c;
}
else{
l = c;
}
}
cout << ans << endl;
}
int main(){
cout << setprecision(18);
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 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 |
4 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
3796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
3856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
3936 KB |
Output is correct |
2 |
Incorrect |
59 ms |
4420 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
72 ms |
5392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
76 ms |
5164 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
337 ms |
20852 KB |
Output is correct |
2 |
Correct |
366 ms |
24472 KB |
Output is correct |
3 |
Correct |
349 ms |
23804 KB |
Output is correct |
4 |
Incorrect |
387 ms |
26116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
357 ms |
24424 KB |
Output is correct |
2 |
Incorrect |
358 ms |
23132 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
416 ms |
24940 KB |
Output is correct |
2 |
Incorrect |
446 ms |
29056 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
450 ms |
29376 KB |
Output is correct |
2 |
Incorrect |
482 ms |
27724 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
478 ms |
29060 KB |
Output is correct |
2 |
Incorrect |
521 ms |
33836 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
510 ms |
33776 KB |
Output is correct |
2 |
Incorrect |
537 ms |
32256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
618 ms |
33324 KB |
Output is correct |
2 |
Incorrect |
667 ms |
38612 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
653 ms |
38336 KB |
Output is correct |
2 |
Incorrect |
624 ms |
36756 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
831 ms |
40692 KB |
Output is correct |
2 |
Incorrect |
788 ms |
48152 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
829 ms |
47904 KB |
Output is correct |
2 |
Incorrect |
797 ms |
45896 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |