#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+3;
const ll MAXM = 60;
const ll MAXL = 31;
const ll MOD = 1e9 + 7;
double 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;
if(x1 <= maximum) 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 = 2e9;
while(hi - lo > 1e-6){
double mid = (hi + lo)/2.0;
if(check(mid)){
hi = mid;
}else{
lo = mid;
}
}
printf("%.6f\n", lo);
//printf("%.5f\n", 50.122324);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
//cin>>t;
while(t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2640 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
2384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
2 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
592 KB |
Output is correct |
3 |
Correct |
3 ms |
592 KB |
Output is correct |
4 |
Correct |
3 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
760 KB |
Output is correct |
2 |
Correct |
3 ms |
2384 KB |
Output is correct |
3 |
Correct |
3 ms |
2384 KB |
Output is correct |
4 |
Correct |
3 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
592 KB |
Output is correct |
3 |
Correct |
3 ms |
592 KB |
Output is correct |
4 |
Correct |
3 ms |
2532 KB |
Output is correct |
5 |
Correct |
3 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
3908 KB |
Output is correct |
2 |
Correct |
34 ms |
4176 KB |
Output is correct |
3 |
Correct |
22 ms |
3408 KB |
Output is correct |
4 |
Correct |
32 ms |
4176 KB |
Output is correct |
5 |
Correct |
19 ms |
3152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
3912 KB |
Output is correct |
2 |
Correct |
30 ms |
3676 KB |
Output is correct |
3 |
Correct |
32 ms |
4176 KB |
Output is correct |
4 |
Correct |
34 ms |
4164 KB |
Output is correct |
5 |
Correct |
40 ms |
4688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
3920 KB |
Output is correct |
2 |
Correct |
36 ms |
4176 KB |
Output is correct |
3 |
Correct |
37 ms |
4060 KB |
Output is correct |
4 |
Correct |
43 ms |
5396 KB |
Output is correct |
5 |
Correct |
35 ms |
4272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
4936 KB |
Output is correct |
2 |
Correct |
49 ms |
4704 KB |
Output is correct |
3 |
Correct |
47 ms |
4548 KB |
Output is correct |
4 |
Correct |
55 ms |
5448 KB |
Output is correct |
5 |
Correct |
41 ms |
4680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
4680 KB |
Output is correct |
2 |
Correct |
47 ms |
4748 KB |
Output is correct |
3 |
Correct |
41 ms |
4432 KB |
Output is correct |
4 |
Correct |
43 ms |
5448 KB |
Output is correct |
5 |
Correct |
41 ms |
4688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
214 ms |
13820 KB |
Output is correct |
2 |
Correct |
247 ms |
17480 KB |
Output is correct |
3 |
Correct |
231 ms |
16968 KB |
Output is correct |
4 |
Correct |
217 ms |
19332 KB |
Output is correct |
5 |
Correct |
190 ms |
16464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
252 ms |
17480 KB |
Output is correct |
2 |
Correct |
286 ms |
16220 KB |
Output is correct |
3 |
Correct |
204 ms |
15432 KB |
Output is correct |
4 |
Correct |
206 ms |
18972 KB |
Output is correct |
5 |
Correct |
215 ms |
16848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
229 ms |
16200 KB |
Output is correct |
2 |
Correct |
306 ms |
20444 KB |
Output is correct |
3 |
Correct |
304 ms |
20040 KB |
Output is correct |
4 |
Correct |
260 ms |
23224 KB |
Output is correct |
5 |
Correct |
242 ms |
19144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
342 ms |
20552 KB |
Output is correct |
2 |
Correct |
361 ms |
19100 KB |
Output is correct |
3 |
Correct |
242 ms |
18084 KB |
Output is correct |
4 |
Correct |
293 ms |
23072 KB |
Output is correct |
5 |
Correct |
246 ms |
20040 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
275 ms |
18504 KB |
Output is correct |
2 |
Correct |
334 ms |
23584 KB |
Output is correct |
3 |
Correct |
313 ms |
22856 KB |
Output is correct |
4 |
Correct |
288 ms |
26440 KB |
Output is correct |
5 |
Correct |
271 ms |
21832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
335 ms |
24092 KB |
Output is correct |
2 |
Correct |
393 ms |
21936 KB |
Output is correct |
3 |
Correct |
314 ms |
21140 KB |
Output is correct |
4 |
Correct |
295 ms |
26192 KB |
Output is correct |
5 |
Correct |
272 ms |
22856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
337 ms |
20808 KB |
Output is correct |
2 |
Correct |
378 ms |
26696 KB |
Output is correct |
3 |
Correct |
361 ms |
25928 KB |
Output is correct |
4 |
Correct |
348 ms |
30024 KB |
Output is correct |
5 |
Correct |
348 ms |
25416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
378 ms |
26220 KB |
Output is correct |
2 |
Correct |
466 ms |
24904 KB |
Output is correct |
3 |
Correct |
374 ms |
23624 KB |
Output is correct |
4 |
Correct |
344 ms |
29768 KB |
Output is correct |
5 |
Correct |
309 ms |
24548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
413 ms |
24392 KB |
Output is correct |
2 |
Correct |
476 ms |
31520 KB |
Output is correct |
3 |
Correct |
468 ms |
30536 KB |
Output is correct |
4 |
Correct |
416 ms |
35292 KB |
Output is correct |
5 |
Correct |
407 ms |
29512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
529 ms |
28864 KB |
Output is correct |
2 |
Correct |
558 ms |
29052 KB |
Output is correct |
3 |
Correct |
420 ms |
28412 KB |
Output is correct |
4 |
Correct |
436 ms |
35404 KB |
Output is correct |
5 |
Correct |
429 ms |
30792 KB |
Output is correct |