#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 (abs(y) <= r - 1e-6)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()){
if(curr >= L)return true;
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 = 1, r = 20e14;
double ans = r;
while(r-l >= 0.000001){
double c = (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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
3876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
77 ms |
3700 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
4076 KB |
Output is correct |
2 |
Incorrect |
80 ms |
4240 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
95 ms |
5316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
5284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
461 ms |
20692 KB |
Output is correct |
2 |
Correct |
458 ms |
23776 KB |
Output is correct |
3 |
Correct |
461 ms |
23556 KB |
Output is correct |
4 |
Incorrect |
510 ms |
25600 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
467 ms |
24304 KB |
Output is correct |
2 |
Incorrect |
482 ms |
22664 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
558 ms |
24144 KB |
Output is correct |
2 |
Incorrect |
560 ms |
27208 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
625 ms |
27472 KB |
Output is correct |
2 |
Incorrect |
562 ms |
25940 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
667 ms |
27968 KB |
Output is correct |
2 |
Incorrect |
694 ms |
31456 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
663 ms |
31960 KB |
Output is correct |
2 |
Incorrect |
651 ms |
30844 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
752 ms |
33124 KB |
Output is correct |
2 |
Incorrect |
782 ms |
37432 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
781 ms |
38260 KB |
Output is correct |
2 |
Incorrect |
800 ms |
35988 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
990 ms |
40528 KB |
Output is correct |
2 |
Execution timed out |
1020 ms |
46564 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1036 ms |
47328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |