#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-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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Incorrect |
10 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
92 ms |
1396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
87 ms |
1504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
63 ms |
1700 KB |
Output is correct |
2 |
Correct |
69 ms |
1568 KB |
Output is correct |
3 |
Correct |
75 ms |
1576 KB |
Output is correct |
4 |
Incorrect |
159 ms |
1880 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
1868 KB |
Output is correct |
2 |
Correct |
76 ms |
1836 KB |
Output is correct |
3 |
Correct |
66 ms |
1916 KB |
Output is correct |
4 |
Incorrect |
154 ms |
1884 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
78 ms |
1884 KB |
Output is correct |
2 |
Correct |
79 ms |
1884 KB |
Output is correct |
3 |
Correct |
66 ms |
1868 KB |
Output is correct |
4 |
Incorrect |
159 ms |
1868 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
353 ms |
8036 KB |
Output is correct |
2 |
Correct |
409 ms |
8192 KB |
Output is correct |
3 |
Correct |
396 ms |
8140 KB |
Output is correct |
4 |
Incorrect |
761 ms |
8148 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
422 ms |
8064 KB |
Output is correct |
2 |
Incorrect |
526 ms |
8260 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
422 ms |
9636 KB |
Output is correct |
2 |
Correct |
494 ms |
9768 KB |
Output is correct |
3 |
Correct |
486 ms |
9596 KB |
Output is correct |
4 |
Incorrect |
928 ms |
9760 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
486 ms |
9668 KB |
Output is correct |
2 |
Incorrect |
695 ms |
9712 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
490 ms |
11288 KB |
Output is correct |
2 |
Correct |
564 ms |
11308 KB |
Output is correct |
3 |
Correct |
553 ms |
11404 KB |
Output is correct |
4 |
Execution timed out |
1066 ms |
11276 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
594 ms |
11292 KB |
Output is correct |
2 |
Incorrect |
755 ms |
11284 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
565 ms |
12848 KB |
Output is correct |
2 |
Correct |
640 ms |
13004 KB |
Output is correct |
3 |
Correct |
634 ms |
12880 KB |
Output is correct |
4 |
Execution timed out |
1092 ms |
12856 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
668 ms |
12856 KB |
Output is correct |
2 |
Incorrect |
833 ms |
12876 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
748 ms |
15976 KB |
Output is correct |
2 |
Correct |
800 ms |
16092 KB |
Output is correct |
3 |
Correct |
816 ms |
16020 KB |
Output is correct |
4 |
Execution timed out |
1099 ms |
15856 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
831 ms |
15868 KB |
Output is correct |
2 |
Execution timed out |
1006 ms |
15868 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |