// author: MisterReaper (Ahmet Alp Orakci)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#include "debug.h"
#define OPEN freopen(".in", "r", stdin); freopen(".out", "w", stdout);
#define TIME cerr << "\n" << fixed << setprecision(2) << 1000.0 * clock() / CLOCKS_PER_SEC << " milliseconds ";
#else
#define debug(...) void(23)
#define debugarr(...) void(23)
#define OPEN void(0000)
#define TIME void(232323233)
#endif
void solve()
{
int n, m; cin >> n >> m;
pair <int, int> arr[n];
for(auto &[a, b] : arr) cin >> a >> b;
auto check = [&](double mid) -> bool
{
double cur = 0;
for(auto [a, b] : arr)
{
double delta = sqrt(mid * mid - b * b);
if(a - delta <= cur) cur = max(cur, a + delta);
}
return m <= cur;
};
double l = 1, r = 1.5e9, res = 1;
while(r - l >= 1e-3)
{
double mid = (l + r) / 2;
if(check(mid))
{
r = mid;
res = mid;
}
else l = mid;
}
cout << fixed << setprecision(6) << res;
return;
}
int32_t main()
{
OPEN;
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1; //cin >> t;
while(t--)
{
solve();
}
TIME;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
316 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
276 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
340 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 |
456 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 |
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 |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
432 KB |
Output is correct |
4 |
Correct |
2 ms |
456 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
2256 KB |
Output is correct |
2 |
Correct |
19 ms |
2520 KB |
Output is correct |
3 |
Correct |
13 ms |
1740 KB |
Output is correct |
4 |
Correct |
25 ms |
2624 KB |
Output is correct |
5 |
Correct |
13 ms |
1364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
2260 KB |
Output is correct |
2 |
Correct |
21 ms |
2164 KB |
Output is correct |
3 |
Correct |
24 ms |
2516 KB |
Output is correct |
4 |
Correct |
31 ms |
2736 KB |
Output is correct |
5 |
Correct |
31 ms |
3056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
2260 KB |
Output is correct |
2 |
Correct |
20 ms |
2740 KB |
Output is correct |
3 |
Correct |
24 ms |
2508 KB |
Output is correct |
4 |
Correct |
34 ms |
3772 KB |
Output is correct |
5 |
Correct |
25 ms |
2516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
3404 KB |
Output is correct |
2 |
Correct |
25 ms |
3264 KB |
Output is correct |
3 |
Correct |
24 ms |
2888 KB |
Output is correct |
4 |
Correct |
35 ms |
3784 KB |
Output is correct |
5 |
Correct |
29 ms |
3116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
3372 KB |
Output is correct |
2 |
Correct |
26 ms |
3264 KB |
Output is correct |
3 |
Correct |
25 ms |
2888 KB |
Output is correct |
4 |
Correct |
35 ms |
3772 KB |
Output is correct |
5 |
Correct |
30 ms |
3028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
12328 KB |
Output is correct |
2 |
Correct |
140 ms |
15792 KB |
Output is correct |
3 |
Correct |
123 ms |
15276 KB |
Output is correct |
4 |
Correct |
167 ms |
17680 KB |
Output is correct |
5 |
Correct |
150 ms |
14908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
130 ms |
16316 KB |
Output is correct |
2 |
Correct |
189 ms |
14732 KB |
Output is correct |
3 |
Correct |
126 ms |
13868 KB |
Output is correct |
4 |
Correct |
171 ms |
17336 KB |
Output is correct |
5 |
Correct |
151 ms |
15420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
131 ms |
14808 KB |
Output is correct |
2 |
Correct |
154 ms |
18888 KB |
Output is correct |
3 |
Correct |
145 ms |
18384 KB |
Output is correct |
4 |
Correct |
220 ms |
21448 KB |
Output is correct |
5 |
Correct |
181 ms |
17668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
19544 KB |
Output is correct |
2 |
Correct |
217 ms |
17612 KB |
Output is correct |
3 |
Correct |
148 ms |
16520 KB |
Output is correct |
4 |
Correct |
214 ms |
21320 KB |
Output is correct |
5 |
Correct |
185 ms |
18404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
150 ms |
17260 KB |
Output is correct |
2 |
Correct |
180 ms |
22084 KB |
Output is correct |
3 |
Correct |
172 ms |
21344 KB |
Output is correct |
4 |
Correct |
238 ms |
24772 KB |
Output is correct |
5 |
Correct |
202 ms |
20204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
182 ms |
22772 KB |
Output is correct |
2 |
Correct |
259 ms |
20484 KB |
Output is correct |
3 |
Correct |
175 ms |
19620 KB |
Output is correct |
4 |
Correct |
262 ms |
24616 KB |
Output is correct |
5 |
Correct |
216 ms |
21376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
169 ms |
19744 KB |
Output is correct |
2 |
Correct |
203 ms |
25220 KB |
Output is correct |
3 |
Correct |
193 ms |
24436 KB |
Output is correct |
4 |
Correct |
272 ms |
28444 KB |
Output is correct |
5 |
Correct |
239 ms |
23960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
213 ms |
25996 KB |
Output is correct |
2 |
Correct |
281 ms |
23376 KB |
Output is correct |
3 |
Correct |
199 ms |
22332 KB |
Output is correct |
4 |
Correct |
280 ms |
28160 KB |
Output is correct |
5 |
Correct |
247 ms |
24268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
225 ms |
24632 KB |
Output is correct |
2 |
Correct |
255 ms |
31424 KB |
Output is correct |
3 |
Correct |
246 ms |
30400 KB |
Output is correct |
4 |
Correct |
353 ms |
35132 KB |
Output is correct |
5 |
Correct |
319 ms |
29396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
274 ms |
32448 KB |
Output is correct |
2 |
Correct |
354 ms |
29116 KB |
Output is correct |
3 |
Correct |
267 ms |
28240 KB |
Output is correct |
4 |
Correct |
348 ms |
35268 KB |
Output is correct |
5 |
Correct |
318 ms |
30684 KB |
Output is correct |