#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define debug(x) cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pld pair<ld, ld>
#define ld long double
#define nl endl
#define tb '\t'
#define sp ' '
#define sqr(x) (x)*(x)
#define arr3 array<int, 3>
using namespace std;
const int MX=1000005, MOD=1000000007, BLOCK=160, INF=2e9+7, LG=62;
const ll INFF=1000000000000000007;
const ld ERR=1e-3, pi=3.14159265358979323846;
ll N, L;
pld A[MX];
bool valid(ld x){
ld best=0;
for(int i=1; i<=N; i++){
ld dist=sqrt(x*x - A[i].se*A[i].se);
ld le=A[i].fi-dist, ri=A[i].fi+dist;
if(le<=best)
best=max(best, ri);
}
return (L<=best);
}
int main(){
fastio;
cin >> N >> L;
for(int i=1; i<=N; i++){
cin >> A[i].fi >> A[i].se;
}
ld le=0, ri=1e10, mi, ans;
while(le+ERR<=ri){
mi=(le+ri)/2;
if(valid(mi)){
ri=mi;
ans=mi;
}else
le=mi;
}
cout << fixed << setprecision(3) << ans << nl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
396 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
468 KB |
Output is correct |
2 |
Correct |
7 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
532 KB |
Output is correct |
4 |
Correct |
7 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
504 KB |
Output is correct |
2 |
Correct |
6 ms |
468 KB |
Output is correct |
3 |
Correct |
5 ms |
468 KB |
Output is correct |
4 |
Correct |
6 ms |
568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
532 KB |
Output is correct |
2 |
Correct |
9 ms |
556 KB |
Output is correct |
3 |
Correct |
5 ms |
468 KB |
Output is correct |
4 |
Correct |
7 ms |
468 KB |
Output is correct |
5 |
Correct |
8 ms |
472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
88 ms |
3456 KB |
Output is correct |
2 |
Correct |
58 ms |
3796 KB |
Output is correct |
3 |
Correct |
43 ms |
2616 KB |
Output is correct |
4 |
Correct |
92 ms |
3760 KB |
Output is correct |
5 |
Correct |
50 ms |
2280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
3512 KB |
Output is correct |
2 |
Correct |
74 ms |
3228 KB |
Output is correct |
3 |
Correct |
86 ms |
3788 KB |
Output is correct |
4 |
Correct |
90 ms |
3972 KB |
Output is correct |
5 |
Correct |
111 ms |
4496 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
3660 KB |
Output is correct |
2 |
Correct |
67 ms |
3984 KB |
Output is correct |
3 |
Correct |
65 ms |
3916 KB |
Output is correct |
4 |
Correct |
137 ms |
5368 KB |
Output is correct |
5 |
Correct |
113 ms |
3916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
4988 KB |
Output is correct |
2 |
Correct |
141 ms |
4796 KB |
Output is correct |
3 |
Correct |
76 ms |
4384 KB |
Output is correct |
4 |
Correct |
143 ms |
5404 KB |
Output is correct |
5 |
Correct |
117 ms |
4660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
4900 KB |
Output is correct |
2 |
Correct |
75 ms |
4776 KB |
Output is correct |
3 |
Correct |
76 ms |
4488 KB |
Output is correct |
4 |
Correct |
142 ms |
5272 KB |
Output is correct |
5 |
Correct |
119 ms |
4684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
343 ms |
20260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
417 ms |
24176 KB |
Output is correct |
2 |
Correct |
542 ms |
21348 KB |
Output is correct |
3 |
Correct |
461 ms |
21356 KB |
Output is correct |
4 |
Correct |
757 ms |
24904 KB |
Output is correct |
5 |
Correct |
623 ms |
21704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
484 ms |
24220 KB |
Output is correct |
2 |
Correct |
484 ms |
28036 KB |
Output is correct |
3 |
Correct |
464 ms |
26956 KB |
Output is correct |
4 |
Correct |
852 ms |
28184 KB |
Output is correct |
5 |
Correct |
715 ms |
25756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
516 ms |
28964 KB |
Output is correct |
2 |
Correct |
688 ms |
25836 KB |
Output is correct |
3 |
Correct |
507 ms |
24608 KB |
Output is correct |
4 |
Correct |
889 ms |
28540 KB |
Output is correct |
5 |
Correct |
748 ms |
26992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
600 ms |
27784 KB |
Output is correct |
2 |
Correct |
646 ms |
32288 KB |
Output is correct |
3 |
Correct |
573 ms |
32368 KB |
Output is correct |
4 |
Execution timed out |
1062 ms |
30400 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
603 ms |
30544 KB |
Output is correct |
2 |
Correct |
760 ms |
30456 KB |
Output is correct |
3 |
Correct |
557 ms |
28932 KB |
Output is correct |
4 |
Correct |
918 ms |
30156 KB |
Output is correct |
5 |
Correct |
815 ms |
32140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
549 ms |
31204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
658 ms |
32888 KB |
Output is correct |
2 |
Correct |
823 ms |
34196 KB |
Output is correct |
3 |
Correct |
648 ms |
34644 KB |
Output is correct |
4 |
Execution timed out |
1034 ms |
32256 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
669 ms |
39792 KB |
Output is correct |
2 |
Correct |
784 ms |
37900 KB |
Output is correct |
3 |
Correct |
717 ms |
38160 KB |
Output is correct |
4 |
Execution timed out |
1078 ms |
32224 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
729 ms |
37032 KB |
Output is correct |
2 |
Execution timed out |
1002 ms |
37688 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |