#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define debug(x) cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pld pair<ld, ld>
#define ld double
#define nl endl
#define tb '\t'
#define sp ' '
#define sqr(x) (x)*(x)
#define arr3 array<int, 3>
using namespace std;
const int MX=1000005, MOD=1000000007, BLOCK=160, INF=2e9+7, LG=62;
const ll INFF=1000000000000000007;
const ld ERR=1e-3, pi=3.14159265358979323846;
int N;
int L;
pll A[MX];
bool valid(ld x){
ld best=0;
for(int i=1; i<=N; i++){
ld dist=sqrt(x*x - A[i].se*A[i].se);
ld le=A[i].fi-dist, ri=A[i].fi+dist;
if(le<=best)
best=max(best, ri);
}
return (L<=best);
}
int main(){
fastio;
cin >> N >> L;
for(int i=1; i<=N; i++){
cin >> A[i].fi >> A[i].se;
}
ld le=0, ri=1e10, mi, ans;
while(le+ERR<=ri){
mi=(le+ri)/2;
if(valid(mi)){
ri=mi;
ans=mi;
}else
le=mi;
}
cout << fixed << setprecision(3) << ans << nl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
324 KB |
Output is correct |
2 |
Correct |
1 ms |
328 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 |
0 ms |
328 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
1 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
372 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
4 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
1868 KB |
Output is correct |
2 |
Correct |
24 ms |
1916 KB |
Output is correct |
3 |
Correct |
16 ms |
1296 KB |
Output is correct |
4 |
Correct |
29 ms |
1988 KB |
Output is correct |
5 |
Correct |
16 ms |
1364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1888 KB |
Output is correct |
2 |
Correct |
23 ms |
1740 KB |
Output is correct |
3 |
Correct |
43 ms |
2188 KB |
Output is correct |
4 |
Correct |
29 ms |
1996 KB |
Output is correct |
5 |
Correct |
42 ms |
2120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1900 KB |
Output is correct |
2 |
Correct |
25 ms |
1996 KB |
Output is correct |
3 |
Correct |
27 ms |
2116 KB |
Output is correct |
4 |
Correct |
45 ms |
2376 KB |
Output is correct |
5 |
Correct |
33 ms |
2216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2284 KB |
Output is correct |
2 |
Correct |
31 ms |
2316 KB |
Output is correct |
3 |
Correct |
31 ms |
2392 KB |
Output is correct |
4 |
Correct |
41 ms |
2364 KB |
Output is correct |
5 |
Correct |
33 ms |
2380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
2336 KB |
Output is correct |
2 |
Correct |
33 ms |
2384 KB |
Output is correct |
3 |
Correct |
30 ms |
2332 KB |
Output is correct |
4 |
Correct |
39 ms |
2412 KB |
Output is correct |
5 |
Correct |
34 ms |
2464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
129 ms |
8856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
156 ms |
8780 KB |
Output is correct |
2 |
Correct |
219 ms |
8904 KB |
Output is correct |
3 |
Correct |
136 ms |
8912 KB |
Output is correct |
4 |
Correct |
296 ms |
8900 KB |
Output is correct |
5 |
Correct |
174 ms |
8908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
148 ms |
10444 KB |
Output is correct |
2 |
Correct |
194 ms |
10508 KB |
Output is correct |
3 |
Correct |
176 ms |
10488 KB |
Output is correct |
4 |
Correct |
234 ms |
10728 KB |
Output is correct |
5 |
Correct |
204 ms |
10472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
10488 KB |
Output is correct |
2 |
Correct |
251 ms |
10436 KB |
Output is correct |
3 |
Correct |
175 ms |
10432 KB |
Output is correct |
4 |
Correct |
218 ms |
10432 KB |
Output is correct |
5 |
Correct |
197 ms |
10476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
190 ms |
12164 KB |
Output is correct |
2 |
Correct |
217 ms |
12024 KB |
Output is correct |
3 |
Correct |
251 ms |
12044 KB |
Output is correct |
4 |
Correct |
283 ms |
12272 KB |
Output is correct |
5 |
Correct |
222 ms |
11700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
226 ms |
12336 KB |
Output is correct |
2 |
Correct |
321 ms |
12036 KB |
Output is correct |
3 |
Correct |
206 ms |
11924 KB |
Output is correct |
4 |
Correct |
280 ms |
12364 KB |
Output is correct |
5 |
Correct |
241 ms |
11760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
208 ms |
13568 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
13900 KB |
Output is correct |
2 |
Correct |
322 ms |
13624 KB |
Output is correct |
3 |
Correct |
228 ms |
13852 KB |
Output is correct |
4 |
Correct |
306 ms |
13732 KB |
Output is correct |
5 |
Correct |
284 ms |
13260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
16496 KB |
Output is correct |
2 |
Correct |
298 ms |
16724 KB |
Output is correct |
3 |
Correct |
302 ms |
16728 KB |
Output is correct |
4 |
Correct |
373 ms |
16324 KB |
Output is correct |
5 |
Correct |
328 ms |
16136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
314 ms |
16644 KB |
Output is correct |
2 |
Correct |
400 ms |
16780 KB |
Output is correct |
3 |
Correct |
306 ms |
16504 KB |
Output is correct |
4 |
Correct |
422 ms |
16336 KB |
Output is correct |
5 |
Correct |
364 ms |
16588 KB |
Output is correct |