#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-ERR <= fim) fim = max(prox_fim, fim);
}
return (fim-ERR >= l);
}
int main()
{_
cin >> n >> l;
for (int i = 0; i < n; i++)
cin >> a[i] >> b[i];
int cnt = 100;
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 |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
484 KB |
Output is correct |
3 |
Correct |
4 ms |
456 KB |
Output is correct |
4 |
Correct |
7 ms |
416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
468 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
7 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
420 KB |
Output is correct |
2 |
Correct |
5 ms |
340 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
8 ms |
416 KB |
Output is correct |
5 |
Correct |
7 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
1488 KB |
Output is correct |
2 |
Correct |
59 ms |
2596 KB |
Output is correct |
3 |
Correct |
36 ms |
1780 KB |
Output is correct |
4 |
Correct |
108 ms |
2576 KB |
Output is correct |
5 |
Correct |
38 ms |
1484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
1548 KB |
Output is correct |
2 |
Correct |
93 ms |
2260 KB |
Output is correct |
3 |
Correct |
108 ms |
2512 KB |
Output is correct |
4 |
Correct |
112 ms |
2764 KB |
Output is correct |
5 |
Correct |
125 ms |
3020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
1628 KB |
Output is correct |
2 |
Correct |
63 ms |
1508 KB |
Output is correct |
3 |
Correct |
55 ms |
1616 KB |
Output is correct |
4 |
Correct |
151 ms |
1788 KB |
Output is correct |
5 |
Correct |
103 ms |
2640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
1848 KB |
Output is correct |
2 |
Correct |
79 ms |
1828 KB |
Output is correct |
3 |
Correct |
65 ms |
1868 KB |
Output is correct |
4 |
Correct |
150 ms |
1848 KB |
Output is correct |
5 |
Correct |
130 ms |
3136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
77 ms |
1780 KB |
Output is correct |
2 |
Correct |
77 ms |
1916 KB |
Output is correct |
3 |
Correct |
64 ms |
1860 KB |
Output is correct |
4 |
Correct |
155 ms |
1880 KB |
Output is correct |
5 |
Correct |
136 ms |
3152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
339 ms |
8144 KB |
Output is correct |
2 |
Correct |
409 ms |
8144 KB |
Output is correct |
3 |
Correct |
386 ms |
8268 KB |
Output is correct |
4 |
Correct |
753 ms |
8144 KB |
Output is correct |
5 |
Correct |
679 ms |
14924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
403 ms |
8144 KB |
Output is correct |
2 |
Correct |
525 ms |
8268 KB |
Output is correct |
3 |
Correct |
328 ms |
13804 KB |
Output is correct |
4 |
Correct |
754 ms |
17472 KB |
Output is correct |
5 |
Correct |
686 ms |
15452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
400 ms |
9676 KB |
Output is correct |
2 |
Correct |
474 ms |
9716 KB |
Output is correct |
3 |
Correct |
463 ms |
9808 KB |
Output is correct |
4 |
Correct |
905 ms |
9836 KB |
Output is correct |
5 |
Correct |
794 ms |
17740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
469 ms |
9808 KB |
Output is correct |
2 |
Correct |
599 ms |
9712 KB |
Output is correct |
3 |
Correct |
388 ms |
16588 KB |
Output is correct |
4 |
Correct |
901 ms |
21500 KB |
Output is correct |
5 |
Correct |
820 ms |
18424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
483 ms |
11280 KB |
Output is correct |
2 |
Correct |
543 ms |
11276 KB |
Output is correct |
3 |
Correct |
574 ms |
11272 KB |
Output is correct |
4 |
Execution timed out |
1057 ms |
11336 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
543 ms |
11256 KB |
Output is correct |
2 |
Correct |
660 ms |
11376 KB |
Output is correct |
3 |
Correct |
467 ms |
19532 KB |
Output is correct |
4 |
Execution timed out |
1078 ms |
24528 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
551 ms |
12840 KB |
Output is correct |
2 |
Correct |
609 ms |
12828 KB |
Output is correct |
3 |
Correct |
612 ms |
12748 KB |
Output is correct |
4 |
Execution timed out |
1096 ms |
12920 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
643 ms |
12820 KB |
Output is correct |
2 |
Correct |
734 ms |
12844 KB |
Output is correct |
3 |
Correct |
525 ms |
22368 KB |
Output is correct |
4 |
Execution timed out |
1065 ms |
28244 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
672 ms |
15920 KB |
Output is correct |
2 |
Correct |
765 ms |
15960 KB |
Output is correct |
3 |
Correct |
752 ms |
16076 KB |
Output is correct |
4 |
Execution timed out |
1089 ms |
16076 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
802 ms |
15952 KB |
Output is correct |
2 |
Correct |
894 ms |
16000 KB |
Output is correct |
3 |
Correct |
683 ms |
28204 KB |
Output is correct |
4 |
Execution timed out |
1084 ms |
35264 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |