#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
template<typename T> using oset =
__gnu_pbds::tree<T, __gnu_pbds::null_type, greater<T>,
__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
#define vt vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define ll long long
#define ull unsigned ll
#define ld long double
#define okey order_of_key
#define oget find_by_order
typedef vt<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
const ll MAXN = 1e6;
const ll MAXM = 60;
const ll MAXL = 31;
const ll MOD = 1e9 + 7;
ll N, L, x[MAXN], y[MAXN];
bool check(double r){
double maximum = 0;
for(int i = 0; i<N; ++i){
double diff = r*r-(double)(y[i]*y[i]);
if(diff < 0) continue;
double sqt = sqrt(diff);
double x1 = x[i] - sqt;
double x2 = sqt + x[i];
if(x1 > maximum) return false;
maximum = max(maximum, x2);
}
return maximum >= L;
}
void solve(){
cin>>N>>L;
for(int i = 0; i<N; ++i){
cin>>x[i]>>y[i];
}
double lo = 0, hi = 1e13;
while(hi - lo > 1e-3){
double mid = (hi + lo)/2;
if(check(mid)){
hi = mid;
}else{
lo = mid;
}
}
printf("%.4f\n", hi);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
//cin>>t;
while(t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
Output is correct |
2 |
Correct |
2 ms |
2384 KB |
Output is correct |
3 |
Incorrect |
3 ms |
2552 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
6736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
6800 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
6736 KB |
Output is correct |
2 |
Incorrect |
20 ms |
6736 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
6736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
6804 KB |
Output is correct |
2 |
Incorrect |
26 ms |
6736 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
129 ms |
10896 KB |
Output is correct |
2 |
Correct |
112 ms |
10824 KB |
Output is correct |
3 |
Correct |
113 ms |
10896 KB |
Output is correct |
4 |
Incorrect |
121 ms |
10884 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
115 ms |
10824 KB |
Output is correct |
2 |
Incorrect |
211 ms |
10824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
150 ms |
11336 KB |
Output is correct |
2 |
Incorrect |
147 ms |
9856 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
132 ms |
9800 KB |
Output is correct |
2 |
Incorrect |
229 ms |
9800 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
186 ms |
11336 KB |
Output is correct |
2 |
Incorrect |
176 ms |
11340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
173 ms |
20808 KB |
Output is correct |
2 |
Incorrect |
278 ms |
19984 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
233 ms |
18916 KB |
Output is correct |
2 |
Incorrect |
229 ms |
21356 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
183 ms |
19168 KB |
Output is correct |
2 |
Incorrect |
308 ms |
19972 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
255 ms |
20560 KB |
Output is correct |
2 |
Incorrect |
240 ms |
16880 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
238 ms |
22692 KB |
Output is correct |
2 |
Incorrect |
367 ms |
19104 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |