#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring>
#include <set>
#include <stack>
#include <bitset>
#define dbug(x) cout << (#x) << " -> " << x << endl
#define ll long long
#define INF (2e9 + 5)
#define MAX (int) (2e6 + 5)
#define MOD 1000000007
#define par pair<int, int>
#define all(v) v.begin(), v.end()
#define sz(x) (int) ((x).size())
#define esq(x) (x<<1)
#define dir(x) ((x<<1)|1)
#define lsb(x) (x & -x)
#define W(x) cout << #x << ": " << x << endl
#define Wii(x) cout << x.first << ' ' << x.second << endl
#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ERR 1e-9
using namespace std;
double l, n, a[MAX], b[MAX];
int check(double raio)
{
double fim = 0;
for (int i = 0; i < n; i++)
{
if (raio < b[i]) continue;
double prox_fim = a[i] + (sqrt((raio*raio) - (b[i]*b[i])));
double prox_ini = a[i] - (sqrt((raio*raio) - (b[i]*b[i])));
if (prox_ini <= fim) fim = max(prox_fim, fim);
}
return (fim >= l);
}
int main()
{_
cin >> n >> l;
for (int i = 0; i < n; i++)
cin >> a[i] >> b[i];
int cnt = 45;
double meio, ini = 0, fim = INF;
while (cnt--)
{
meio = (ini+fim)/2;
if (check(meio)) fim = meio;
else ini = meio;
}
cout << fixed << setprecision(6) << fim << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 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 |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
6 ms |
392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
416 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
5 ms |
424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
1484 KB |
Output is correct |
2 |
Correct |
49 ms |
1484 KB |
Output is correct |
3 |
Correct |
33 ms |
1160 KB |
Output is correct |
4 |
Correct |
65 ms |
1388 KB |
Output is correct |
5 |
Correct |
30 ms |
1112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
1492 KB |
Output is correct |
2 |
Correct |
54 ms |
1364 KB |
Output is correct |
3 |
Correct |
63 ms |
1540 KB |
Output is correct |
4 |
Correct |
69 ms |
1556 KB |
Output is correct |
5 |
Correct |
76 ms |
1676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
1612 KB |
Output is correct |
2 |
Correct |
47 ms |
1492 KB |
Output is correct |
3 |
Correct |
47 ms |
1616 KB |
Output is correct |
4 |
Correct |
94 ms |
1872 KB |
Output is correct |
5 |
Correct |
58 ms |
1716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
1884 KB |
Output is correct |
2 |
Correct |
60 ms |
1800 KB |
Output is correct |
3 |
Correct |
50 ms |
1848 KB |
Output is correct |
4 |
Correct |
98 ms |
1912 KB |
Output is correct |
5 |
Correct |
75 ms |
1816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
1776 KB |
Output is correct |
2 |
Correct |
61 ms |
1820 KB |
Output is correct |
3 |
Correct |
50 ms |
1820 KB |
Output is correct |
4 |
Correct |
98 ms |
1832 KB |
Output is correct |
5 |
Correct |
78 ms |
1800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
245 ms |
8120 KB |
Output is correct |
2 |
Correct |
299 ms |
8148 KB |
Output is correct |
3 |
Correct |
285 ms |
8140 KB |
Output is correct |
4 |
Correct |
469 ms |
8064 KB |
Output is correct |
5 |
Correct |
402 ms |
8152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
328 ms |
8148 KB |
Output is correct |
2 |
Correct |
335 ms |
8148 KB |
Output is correct |
3 |
Correct |
248 ms |
8140 KB |
Output is correct |
4 |
Correct |
458 ms |
8148 KB |
Output is correct |
5 |
Correct |
406 ms |
8140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
294 ms |
9828 KB |
Output is correct |
2 |
Correct |
354 ms |
9720 KB |
Output is correct |
3 |
Correct |
342 ms |
9712 KB |
Output is correct |
4 |
Correct |
576 ms |
9660 KB |
Output is correct |
5 |
Correct |
470 ms |
9724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
362 ms |
9628 KB |
Output is correct |
2 |
Correct |
385 ms |
9704 KB |
Output is correct |
3 |
Correct |
302 ms |
9712 KB |
Output is correct |
4 |
Correct |
571 ms |
9736 KB |
Output is correct |
5 |
Correct |
481 ms |
9712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
355 ms |
11272 KB |
Output is correct |
2 |
Correct |
413 ms |
11168 KB |
Output is correct |
3 |
Correct |
408 ms |
11180 KB |
Output is correct |
4 |
Correct |
655 ms |
11400 KB |
Output is correct |
5 |
Correct |
548 ms |
11320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
445 ms |
11212 KB |
Output is correct |
2 |
Correct |
441 ms |
11284 KB |
Output is correct |
3 |
Correct |
359 ms |
11212 KB |
Output is correct |
4 |
Correct |
655 ms |
11284 KB |
Output is correct |
5 |
Correct |
560 ms |
11280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
394 ms |
12840 KB |
Output is correct |
2 |
Correct |
490 ms |
12896 KB |
Output is correct |
3 |
Correct |
472 ms |
12728 KB |
Output is correct |
4 |
Correct |
801 ms |
12844 KB |
Output is correct |
5 |
Correct |
646 ms |
12844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
513 ms |
12840 KB |
Output is correct |
2 |
Correct |
497 ms |
12756 KB |
Output is correct |
3 |
Correct |
405 ms |
12776 KB |
Output is correct |
4 |
Correct |
750 ms |
12844 KB |
Output is correct |
5 |
Correct |
642 ms |
12896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
491 ms |
15976 KB |
Output is correct |
2 |
Correct |
587 ms |
16016 KB |
Output is correct |
3 |
Correct |
579 ms |
15924 KB |
Output is correct |
4 |
Correct |
940 ms |
15980 KB |
Output is correct |
5 |
Correct |
785 ms |
29644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
603 ms |
15960 KB |
Output is correct |
2 |
Correct |
620 ms |
15952 KB |
Output is correct |
3 |
Correct |
538 ms |
15868 KB |
Output is correct |
4 |
Correct |
943 ms |
16036 KB |
Output is correct |
5 |
Correct |
813 ms |
30712 KB |
Output is correct |