#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)(x).size()
#define ft first
#define sd second
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef vector<vi> vvi;
#define dbg if(1)
template <class _T>
string printbit(_T x) {string s="";while(x){s=((x%2)?'1':'0')+s;x/=2;} return s;}
template <class _T>
string printbit(_T x, int len) {string s="";while(len--){s=((x%2)?'1':'0')+s;x/=2;} return s;}
const int MOD = 1e9+7;
const int INF = 1e9;
const int maxN = 1e6+5;
ll n;
long double l;
vector<pair<long double, long double>> cor(maxN);
bool check(long double mid){
vector<pair<long double, long double>> coord;
for (int i =0;i<n;i++){
auto p = cor[i];
auto power = mid;
if (p.second>power) continue;
else {
long double len = sqrt(power*power - p.sd*p.sd);
coord.pb(make_pair(p.ft-len, p.ft+len));
}
}
sort(all(coord));
if (coord.empty() || coord[0].ft>0) return false;
long double curr = 0;
for (auto x:coord){
if (x.ft>curr) return false;
curr = x.sd;
if (curr>=l) return true;
}
return curr>=l;
}
void solve(){
// cout<<sizeof(l);
// return;
cin>>n>>l;
for (int i = 0;i<n;i++) cin>>cor[i].ft>>cor[i].sd;
long double l = 0, r = 1e10;
while(r-l>1e-4){
long double mid = (l+r)/2;
if (check(mid)) r = mid;
else l = mid;
}
cout<<fixed<<setprecision(6)<<r;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t = 1;
// cin>>t;
while(t--){
solve();
cout<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
31520 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
31636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
31932 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
32056 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
32164 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
32048 KB |
Output is correct |
2 |
Correct |
45 ms |
32224 KB |
Output is correct |
3 |
Correct |
51 ms |
32064 KB |
Output is correct |
4 |
Incorrect |
50 ms |
32084 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
435 ms |
38164 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
520 ms |
38232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
449 ms |
38628 KB |
Output is correct |
2 |
Correct |
613 ms |
38352 KB |
Output is correct |
3 |
Correct |
700 ms |
38460 KB |
Output is correct |
4 |
Incorrect |
682 ms |
38860 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
600 ms |
38928 KB |
Output is correct |
2 |
Correct |
712 ms |
39008 KB |
Output is correct |
3 |
Correct |
866 ms |
38996 KB |
Output is correct |
4 |
Incorrect |
632 ms |
38892 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
524 ms |
38972 KB |
Output is correct |
2 |
Correct |
713 ms |
38900 KB |
Output is correct |
3 |
Correct |
866 ms |
39028 KB |
Output is correct |
4 |
Incorrect |
549 ms |
38896 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1097 ms |
63756 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1092 ms |
63768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1046 ms |
80984 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1085 ms |
80928 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1097 ms |
80920 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1092 ms |
80936 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1090 ms |
81024 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1083 ms |
80884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1096 ms |
80928 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1092 ms |
80876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |