#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=2e9, 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 |
332 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 |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 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 |
396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
472 KB |
Output is correct |
2 |
Correct |
4 ms |
468 KB |
Output is correct |
3 |
Correct |
6 ms |
468 KB |
Output is correct |
4 |
Correct |
9 ms |
568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
464 KB |
Output is correct |
2 |
Correct |
5 ms |
468 KB |
Output is correct |
3 |
Correct |
4 ms |
420 KB |
Output is correct |
4 |
Correct |
7 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
472 KB |
Output is correct |
2 |
Correct |
6 ms |
468 KB |
Output is correct |
3 |
Correct |
4 ms |
468 KB |
Output is correct |
4 |
Correct |
7 ms |
508 KB |
Output is correct |
5 |
Correct |
5 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
3080 KB |
Output is correct |
2 |
Correct |
81 ms |
3128 KB |
Output is correct |
3 |
Incorrect |
57 ms |
2508 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
3276 KB |
Output is correct |
2 |
Correct |
76 ms |
2980 KB |
Output is correct |
3 |
Correct |
103 ms |
3372 KB |
Output is correct |
4 |
Incorrect |
89 ms |
3404 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
3584 KB |
Output is correct |
2 |
Correct |
75 ms |
3416 KB |
Output is correct |
3 |
Incorrect |
82 ms |
3484 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
3900 KB |
Output is correct |
2 |
Correct |
75 ms |
3964 KB |
Output is correct |
3 |
Incorrect |
78 ms |
3916 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
3924 KB |
Output is correct |
2 |
Correct |
97 ms |
3916 KB |
Output is correct |
3 |
Correct |
91 ms |
3916 KB |
Output is correct |
4 |
Correct |
133 ms |
3956 KB |
Output is correct |
5 |
Correct |
108 ms |
3988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
330 ms |
16488 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
401 ms |
16660 KB |
Output is correct |
2 |
Correct |
552 ms |
17080 KB |
Output is correct |
3 |
Correct |
407 ms |
16856 KB |
Output is correct |
4 |
Correct |
692 ms |
16840 KB |
Output is correct |
5 |
Incorrect |
566 ms |
17004 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
398 ms |
19620 KB |
Output is correct |
2 |
Correct |
454 ms |
20028 KB |
Output is correct |
3 |
Correct |
468 ms |
20084 KB |
Output is correct |
4 |
Correct |
848 ms |
20264 KB |
Output is correct |
5 |
Correct |
670 ms |
19996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
462 ms |
19492 KB |
Output is correct |
2 |
Correct |
703 ms |
19876 KB |
Output is correct |
3 |
Correct |
484 ms |
19880 KB |
Output is correct |
4 |
Correct |
950 ms |
20008 KB |
Output is correct |
5 |
Correct |
681 ms |
20048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
531 ms |
22984 KB |
Output is correct |
2 |
Correct |
544 ms |
23136 KB |
Output is correct |
3 |
Correct |
492 ms |
22484 KB |
Output is correct |
4 |
Correct |
935 ms |
22888 KB |
Output is correct |
5 |
Correct |
848 ms |
30828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
547 ms |
22700 KB |
Output is correct |
2 |
Correct |
721 ms |
22748 KB |
Output is correct |
3 |
Correct |
593 ms |
22988 KB |
Output is correct |
4 |
Correct |
899 ms |
23244 KB |
Output is correct |
5 |
Correct |
872 ms |
22852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
495 ms |
26016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
639 ms |
26136 KB |
Output is correct |
2 |
Correct |
842 ms |
26228 KB |
Output is correct |
3 |
Correct |
625 ms |
26052 KB |
Output is correct |
4 |
Execution timed out |
1062 ms |
26348 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
630 ms |
32408 KB |
Output is correct |
2 |
Correct |
799 ms |
32664 KB |
Output is correct |
3 |
Correct |
752 ms |
32776 KB |
Output is correct |
4 |
Execution timed out |
1074 ms |
32076 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
773 ms |
32648 KB |
Output is correct |
2 |
Execution timed out |
1043 ms |
32736 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |