#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 (3e9 + 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 = prox_fim;
}
return (fim >= 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 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
4 ms |
372 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
352 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Incorrect |
7 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
1484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
1552 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
1696 KB |
Output is correct |
2 |
Correct |
86 ms |
1612 KB |
Output is correct |
3 |
Correct |
60 ms |
1656 KB |
Output is correct |
4 |
Incorrect |
156 ms |
1876 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
1764 KB |
Output is correct |
2 |
Correct |
78 ms |
1860 KB |
Output is correct |
3 |
Correct |
66 ms |
1880 KB |
Output is correct |
4 |
Incorrect |
155 ms |
1884 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
1864 KB |
Output is correct |
2 |
Correct |
82 ms |
1804 KB |
Output is correct |
3 |
Correct |
69 ms |
1880 KB |
Output is correct |
4 |
Incorrect |
152 ms |
1868 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
348 ms |
8296 KB |
Output is correct |
2 |
Correct |
434 ms |
8148 KB |
Output is correct |
3 |
Correct |
390 ms |
8048 KB |
Output is correct |
4 |
Incorrect |
762 ms |
8256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
422 ms |
8236 KB |
Output is correct |
2 |
Incorrect |
540 ms |
8152 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
419 ms |
9720 KB |
Output is correct |
2 |
Correct |
477 ms |
9608 KB |
Output is correct |
3 |
Correct |
502 ms |
9704 KB |
Output is correct |
4 |
Incorrect |
941 ms |
9712 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
506 ms |
9648 KB |
Output is correct |
2 |
Incorrect |
660 ms |
9864 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
495 ms |
11280 KB |
Output is correct |
2 |
Correct |
573 ms |
11280 KB |
Output is correct |
3 |
Correct |
553 ms |
11276 KB |
Output is correct |
4 |
Execution timed out |
1078 ms |
11312 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
591 ms |
11280 KB |
Output is correct |
2 |
Incorrect |
740 ms |
11200 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
570 ms |
12868 KB |
Output is correct |
2 |
Correct |
658 ms |
12844 KB |
Output is correct |
3 |
Correct |
636 ms |
12840 KB |
Output is correct |
4 |
Execution timed out |
1098 ms |
12880 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
683 ms |
12844 KB |
Output is correct |
2 |
Incorrect |
861 ms |
12876 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
717 ms |
15976 KB |
Output is correct |
2 |
Correct |
846 ms |
15976 KB |
Output is correct |
3 |
Correct |
803 ms |
15900 KB |
Output is correct |
4 |
Execution timed out |
1094 ms |
16000 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
860 ms |
15972 KB |
Output is correct |
2 |
Incorrect |
978 ms |
15976 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |