#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 = 50;
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 |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
224 KB |
Output is correct |
4 |
Correct |
1 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 |
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 |
340 KB |
Output is correct |
3 |
Correct |
2 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 |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
520 KB |
Output is correct |
4 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
352 KB |
Output is correct |
3 |
Correct |
5 ms |
416 KB |
Output is correct |
4 |
Correct |
5 ms |
340 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 |
4 ms |
408 KB |
Output is correct |
4 |
Correct |
5 ms |
416 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
1484 KB |
Output is correct |
2 |
Correct |
58 ms |
1520 KB |
Output is correct |
3 |
Correct |
30 ms |
1108 KB |
Output is correct |
4 |
Correct |
76 ms |
1476 KB |
Output is correct |
5 |
Correct |
27 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
1480 KB |
Output is correct |
2 |
Correct |
55 ms |
1384 KB |
Output is correct |
3 |
Correct |
70 ms |
1516 KB |
Output is correct |
4 |
Correct |
75 ms |
1556 KB |
Output is correct |
5 |
Correct |
83 ms |
1712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
1568 KB |
Output is correct |
2 |
Correct |
51 ms |
1492 KB |
Output is correct |
3 |
Correct |
48 ms |
1592 KB |
Output is correct |
4 |
Correct |
120 ms |
1872 KB |
Output is correct |
5 |
Correct |
84 ms |
1700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
1900 KB |
Output is correct |
2 |
Correct |
62 ms |
1900 KB |
Output is correct |
3 |
Correct |
52 ms |
1876 KB |
Output is correct |
4 |
Correct |
122 ms |
1836 KB |
Output is correct |
5 |
Correct |
88 ms |
1776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
1820 KB |
Output is correct |
2 |
Correct |
60 ms |
1884 KB |
Output is correct |
3 |
Correct |
52 ms |
1840 KB |
Output is correct |
4 |
Correct |
109 ms |
1884 KB |
Output is correct |
5 |
Correct |
86 ms |
1772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
275 ms |
8148 KB |
Output is correct |
2 |
Correct |
321 ms |
8148 KB |
Output is correct |
3 |
Correct |
302 ms |
8260 KB |
Output is correct |
4 |
Correct |
547 ms |
8100 KB |
Output is correct |
5 |
Correct |
438 ms |
8148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
336 ms |
8116 KB |
Output is correct |
2 |
Correct |
344 ms |
8152 KB |
Output is correct |
3 |
Correct |
252 ms |
8140 KB |
Output is correct |
4 |
Correct |
545 ms |
8216 KB |
Output is correct |
5 |
Correct |
431 ms |
8220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
311 ms |
9720 KB |
Output is correct |
2 |
Correct |
371 ms |
9688 KB |
Output is correct |
3 |
Correct |
374 ms |
9632 KB |
Output is correct |
4 |
Correct |
600 ms |
9768 KB |
Output is correct |
5 |
Correct |
527 ms |
9740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
380 ms |
9680 KB |
Output is correct |
2 |
Correct |
432 ms |
9720 KB |
Output is correct |
3 |
Correct |
324 ms |
9820 KB |
Output is correct |
4 |
Correct |
628 ms |
9716 KB |
Output is correct |
5 |
Correct |
520 ms |
9784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
402 ms |
11280 KB |
Output is correct |
2 |
Correct |
437 ms |
11284 KB |
Output is correct |
3 |
Correct |
416 ms |
11560 KB |
Output is correct |
4 |
Correct |
726 ms |
11320 KB |
Output is correct |
5 |
Correct |
610 ms |
20304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
443 ms |
11268 KB |
Output is correct |
2 |
Correct |
481 ms |
11212 KB |
Output is correct |
3 |
Correct |
378 ms |
11224 KB |
Output is correct |
4 |
Correct |
737 ms |
11276 KB |
Output is correct |
5 |
Correct |
616 ms |
11276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
405 ms |
12840 KB |
Output is correct |
2 |
Correct |
505 ms |
12868 KB |
Output is correct |
3 |
Correct |
539 ms |
12844 KB |
Output is correct |
4 |
Correct |
847 ms |
12736 KB |
Output is correct |
5 |
Correct |
685 ms |
12840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
549 ms |
12840 KB |
Output is correct |
2 |
Correct |
535 ms |
12840 KB |
Output is correct |
3 |
Correct |
422 ms |
12792 KB |
Output is correct |
4 |
Correct |
840 ms |
12732 KB |
Output is correct |
5 |
Correct |
742 ms |
24376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
522 ms |
15948 KB |
Output is correct |
2 |
Correct |
656 ms |
15968 KB |
Output is correct |
3 |
Correct |
645 ms |
15964 KB |
Output is correct |
4 |
Execution timed out |
1026 ms |
16000 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
671 ms |
16080 KB |
Output is correct |
2 |
Correct |
669 ms |
15892 KB |
Output is correct |
3 |
Correct |
567 ms |
15972 KB |
Output is correct |
4 |
Execution timed out |
1012 ms |
15976 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |