#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define mask(i) (1LL << (i))
#define task "name"
#define ld long double
#define ull unsigned long long
using namespace std;
const ll mxN = 1e6 + 7;
const ll inf = 1e9 + 277;
const ll mod = 2147483648;
const ll infll = 1e18 + 7;
const ll base = 307;
template <typename T1, typename T2> bool minimize(T1 &a, T2 b) {
if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b) {
if (a < b) {a = b; return true;} return false;
}
struct Point{
int x , y;
} a[mxN];
int n , L;
bool ok(ld x)
{
vector<pair<ld , ld>> seg;
for(int i = 1 ; i <= n ; i++) {
ld h = abs(a[i].y);
if(h > x) continue;
if(h == x) seg.push_back({a[i].x , a[i].x});
if(h < x) {
ld leng = sqrt(x * x - h * h);
ld l = a[i].x - leng;
ld r = a[i].x + leng;
seg.push_back({l , r});
}
}
sort(seg.begin() , seg.end());
ld minl = 0;
for(auto it : seg) {
ld l = it.fi;
ld r = it.se;
if(l <= minl) minl = max(minl , r);
}
return minl >= L;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// freopen("task.inp" , "r" , stdin);
// freopen("task.out" , "w" , stdout);
cin >> n >> L;
for(int i = 1 ; i <= n ; i++) cin >> a[i].x >> a[i].y;
ld l = 0 , r = 1.5e9;
for(int i = 1 ; i <= 100 ; i++) {
ld mid = (l + r) / 2;
if(ok(mid)) r = mid;
else l = mid;
}
cout << fixed << setprecision(6) << l;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
560 KB |
Output is correct |
2 |
Correct |
25 ms |
564 KB |
Output is correct |
3 |
Correct |
7 ms |
460 KB |
Output is correct |
4 |
Correct |
22 ms |
888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
860 KB |
Output is correct |
2 |
Correct |
54 ms |
788 KB |
Output is correct |
3 |
Correct |
64 ms |
780 KB |
Output is correct |
4 |
Correct |
15 ms |
788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
952 KB |
Output is correct |
2 |
Correct |
54 ms |
792 KB |
Output is correct |
3 |
Correct |
66 ms |
788 KB |
Output is correct |
4 |
Correct |
15 ms |
788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
784 KB |
Output is correct |
2 |
Correct |
60 ms |
784 KB |
Output is correct |
3 |
Correct |
78 ms |
780 KB |
Output is correct |
4 |
Correct |
14 ms |
776 KB |
Output is correct |
5 |
Correct |
23 ms |
856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
501 ms |
7388 KB |
Output is correct |
2 |
Execution timed out |
1093 ms |
7540 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
328 ms |
7504 KB |
Output is correct |
2 |
Correct |
274 ms |
7188 KB |
Output is correct |
3 |
Correct |
289 ms |
7688 KB |
Output is correct |
4 |
Correct |
243 ms |
7528 KB |
Output is correct |
5 |
Correct |
231 ms |
7820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
8048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1099 ms |
8444 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1095 ms |
8472 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1090 ms |
38600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1093 ms |
40720 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1094 ms |
57456 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1079 ms |
60436 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1078 ms |
59160 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
62736 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
60756 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1094 ms |
65352 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1091 ms |
64136 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1086 ms |
70072 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |