#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define ff first
#define ss second
#define endl "\n"
#define pb(x) push_back(x)
#define pp() pop_back()
#define inf LONG_MAX
#define dvg(x) cout<<#x<<" "<<x<<endl;
#define dvg2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define dvgv(x) cout<<#x<<" { "; for(auto i : x) {cout<<i<<" ";} cout<<"}"<<endl;
#define dvgp(x) cout<<#x" {"<<x.ff<<", "<<x.ss<<"}"<<endl;
int dx[] {-1, 0, 1, 0, 1, 1, -1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
int const N = 1e5 + 10;
double const eps = 1e-3;
int main()
{
fastio();
int n;
ll l;
cin>>n>>l;
vector<pll> v(n);
for(int i = 0; i < n; i++)
cin>>v[i].ff>>v[i].ss;
double lo = 0, hi = 1.5e9;
for(int it = 0; it < 65; it++){
double mid = (hi + lo)/2;
double cur = 0;
for(int i = 0; i < n; i++){
double p = sqrt(mid*mid - v[i].ss*v[i].ss);
double a = v[i].ff - p, b = v[i].ff + p;
if(a <= cur) cur = max(cur, b);
}
if(cur >= l)
hi = mid;
else
lo = mid;
}
cout<<setprecision(12)<<fixed<<lo<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
2 ms |
388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
2260 KB |
Output is correct |
2 |
Correct |
28 ms |
2516 KB |
Output is correct |
3 |
Correct |
20 ms |
1748 KB |
Output is correct |
4 |
Correct |
39 ms |
2652 KB |
Output is correct |
5 |
Correct |
20 ms |
1488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
2160 KB |
Output is correct |
2 |
Correct |
34 ms |
2188 KB |
Output is correct |
3 |
Correct |
46 ms |
2612 KB |
Output is correct |
4 |
Correct |
39 ms |
2772 KB |
Output is correct |
5 |
Correct |
44 ms |
3076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
2336 KB |
Output is correct |
2 |
Correct |
33 ms |
2748 KB |
Output is correct |
3 |
Correct |
32 ms |
2516 KB |
Output is correct |
4 |
Correct |
53 ms |
3784 KB |
Output is correct |
5 |
Correct |
40 ms |
2516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
3408 KB |
Output is correct |
2 |
Correct |
36 ms |
3292 KB |
Output is correct |
3 |
Correct |
43 ms |
2904 KB |
Output is correct |
4 |
Correct |
57 ms |
3800 KB |
Output is correct |
5 |
Correct |
47 ms |
3020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
3288 KB |
Output is correct |
2 |
Correct |
38 ms |
3284 KB |
Output is correct |
3 |
Correct |
37 ms |
2908 KB |
Output is correct |
4 |
Correct |
52 ms |
3788 KB |
Output is correct |
5 |
Correct |
46 ms |
3148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
169 ms |
12348 KB |
Output is correct |
2 |
Correct |
186 ms |
15820 KB |
Output is correct |
3 |
Correct |
181 ms |
15308 KB |
Output is correct |
4 |
Correct |
266 ms |
17608 KB |
Output is correct |
5 |
Correct |
243 ms |
14916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
195 ms |
16320 KB |
Output is correct |
2 |
Correct |
368 ms |
14668 KB |
Output is correct |
3 |
Correct |
183 ms |
13896 KB |
Output is correct |
4 |
Correct |
253 ms |
17480 KB |
Output is correct |
5 |
Correct |
247 ms |
15692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
193 ms |
14808 KB |
Output is correct |
2 |
Correct |
230 ms |
18876 KB |
Output is correct |
3 |
Correct |
221 ms |
18400 KB |
Output is correct |
4 |
Correct |
338 ms |
21580 KB |
Output is correct |
5 |
Correct |
287 ms |
17636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
241 ms |
19540 KB |
Output is correct |
2 |
Correct |
426 ms |
17636 KB |
Output is correct |
3 |
Correct |
215 ms |
16476 KB |
Output is correct |
4 |
Correct |
346 ms |
21344 KB |
Output is correct |
5 |
Correct |
282 ms |
18520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
238 ms |
17272 KB |
Output is correct |
2 |
Correct |
283 ms |
22024 KB |
Output is correct |
3 |
Correct |
261 ms |
21376 KB |
Output is correct |
4 |
Correct |
373 ms |
24720 KB |
Output is correct |
5 |
Correct |
327 ms |
20236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
274 ms |
22776 KB |
Output is correct |
2 |
Correct |
494 ms |
20528 KB |
Output is correct |
3 |
Correct |
266 ms |
19584 KB |
Output is correct |
4 |
Correct |
376 ms |
24572 KB |
Output is correct |
5 |
Correct |
337 ms |
21504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
267 ms |
19736 KB |
Output is correct |
2 |
Correct |
299 ms |
25248 KB |
Output is correct |
3 |
Correct |
297 ms |
24472 KB |
Output is correct |
4 |
Correct |
411 ms |
28448 KB |
Output is correct |
5 |
Correct |
392 ms |
23960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
328 ms |
26012 KB |
Output is correct |
2 |
Correct |
556 ms |
23320 KB |
Output is correct |
3 |
Correct |
302 ms |
22304 KB |
Output is correct |
4 |
Correct |
419 ms |
28452 KB |
Output is correct |
5 |
Correct |
392 ms |
24360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
330 ms |
24524 KB |
Output is correct |
2 |
Correct |
388 ms |
31592 KB |
Output is correct |
3 |
Correct |
379 ms |
30540 KB |
Output is correct |
4 |
Correct |
539 ms |
35160 KB |
Output is correct |
5 |
Correct |
486 ms |
29544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
409 ms |
32336 KB |
Output is correct |
2 |
Correct |
721 ms |
29160 KB |
Output is correct |
3 |
Correct |
401 ms |
28260 KB |
Output is correct |
4 |
Correct |
549 ms |
35328 KB |
Output is correct |
5 |
Correct |
500 ms |
30824 KB |
Output is correct |