#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
#define all(x) x.begin(), x.end()
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(x) freopen(x ".in", "r", stdin); freopen(x ".out", "w", stdout)
#define endl '\n'
#define pb push_back
#define ms(x, y) memset(x, y, sizeof x)
#define out(x) {cout << x << '\n'; return;}
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#ifndef ONLINE_JUDGE
#include "C:/debugtemplate.cpp"
#else
#define debug(...)
#endif
#define int ll
int n, L;
vector<pii> a;
bool chk(ld x){
ld mx = 0;
for (int i = 0 ; i < n ; i++){
ld d = sqrt(x*x - a[i].ss*a[i].ss);
ld x = a[i].ff - d, y = a[i].ff + d;
if (x <= mx) mx = max(mx, y);
}
return (mx < L);
}
int32_t main(){
fast_io;
cout << fixed << setprecision(12);
cin >> n >> L;
a.assign(n, {0, 0});
for (int i = 0 ; i < n ; i++){
int x, h; cin >> x >> h;
a[i] = {x, h};
}
ld l = 1, r = 1e10, mid;
for (int i = 0 ; i < 60 ; i++){
mid = l + (r-l)/2;
if (chk(mid)) l = mid;
else r = mid;
}
cout << l << endl;
return 0;
}
Compilation message
mobile.cpp:20:10: fatal error: C:/debugtemplate.cpp: No such file or directory
20 | #include "C:/debugtemplate.cpp"
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.