#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define ld long double
#define pl pair<ll, ll>
#define vi vector<ll>
#define vii vector<vi>
#define vc vector<char>
#define vcc vector<vc>
#define vp vector<pl>
#define mi map<ll,ll>
#define mc map<char,ll>
#define sortx(X) sort(X.begin(),X.end());
#define all(X) X.begin(),X.end()
#define ln '\n'
#define YES {cout << "YES\n"; return;}
#define NO {cout << "NO\n"; return;}
#define MUN {cout << "-1\n"; return;}
const int MODE = 1e9 + 7;
using namespace std;
void solve(int tc) {
ll n, len;
cin >> n >> len;
vp X(n);
for (int i = 0; i < n; i++)
cin >> X[i].first >> X[i].second;
ld l = 0, r = 1e12;
ld err = 1e-6;
while (r - l > err)
{
double mid = (l + r) / 2, curr = 0;
for (int i = 0; i < n; i++) {
double delta = sqrt(mid * mid - X[i].second * X[i].second);
double a = X[i].first - delta, b = X[i].first + delta;
if (a <= curr) curr = max(curr, b);
}
if (curr >= len) r = mid;
else l = mid;
}
cout << fixed << setprecision(6) << l << '\n';
}
int main()
{
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int size = 1;
//freopen("loan.in", "r", stdin);
//freopen("loan.out", "w", stdout);
//cin >> size;
for (int i = 1; i <= size; i++) solve(i);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
508 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
3 ms |
336 KB |
Output is correct |
4 |
Correct |
4 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
716 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
3 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
2 ms |
508 KB |
Output is correct |
4 |
Correct |
4 ms |
336 KB |
Output is correct |
5 |
Correct |
3 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
1616 KB |
Output is correct |
2 |
Correct |
23 ms |
1616 KB |
Output is correct |
3 |
Correct |
19 ms |
1104 KB |
Output is correct |
4 |
Correct |
45 ms |
1616 KB |
Output is correct |
5 |
Correct |
21 ms |
1104 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
1616 KB |
Output is correct |
2 |
Correct |
41 ms |
1376 KB |
Output is correct |
3 |
Correct |
42 ms |
1616 KB |
Output is correct |
4 |
Correct |
44 ms |
1616 KB |
Output is correct |
5 |
Correct |
49 ms |
1616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
1616 KB |
Output is correct |
2 |
Correct |
34 ms |
1616 KB |
Output is correct |
3 |
Correct |
39 ms |
1616 KB |
Output is correct |
4 |
Correct |
60 ms |
1872 KB |
Output is correct |
5 |
Correct |
43 ms |
1616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
1872 KB |
Output is correct |
2 |
Correct |
30 ms |
1872 KB |
Output is correct |
3 |
Correct |
33 ms |
1872 KB |
Output is correct |
4 |
Correct |
85 ms |
1872 KB |
Output is correct |
5 |
Correct |
65 ms |
1872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
1872 KB |
Output is correct |
2 |
Correct |
32 ms |
1872 KB |
Output is correct |
3 |
Correct |
36 ms |
1872 KB |
Output is correct |
4 |
Correct |
65 ms |
1872 KB |
Output is correct |
5 |
Correct |
56 ms |
1872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
140 ms |
8272 KB |
Output is correct |
2 |
Correct |
150 ms |
8272 KB |
Output is correct |
3 |
Correct |
156 ms |
8272 KB |
Output is correct |
4 |
Correct |
351 ms |
8272 KB |
Output is correct |
5 |
Correct |
269 ms |
8272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
156 ms |
8272 KB |
Output is correct |
2 |
Correct |
296 ms |
8272 KB |
Output is correct |
3 |
Correct |
177 ms |
8272 KB |
Output is correct |
4 |
Correct |
325 ms |
8056 KB |
Output is correct |
5 |
Correct |
293 ms |
8272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
175 ms |
9808 KB |
Output is correct |
2 |
Correct |
178 ms |
9808 KB |
Output is correct |
3 |
Correct |
185 ms |
9808 KB |
Output is correct |
4 |
Correct |
384 ms |
9808 KB |
Output is correct |
5 |
Correct |
325 ms |
9808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
189 ms |
9808 KB |
Output is correct |
2 |
Correct |
370 ms |
9808 KB |
Output is correct |
3 |
Correct |
228 ms |
9808 KB |
Output is correct |
4 |
Correct |
385 ms |
9808 KB |
Output is correct |
5 |
Correct |
341 ms |
9808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
193 ms |
11344 KB |
Output is correct |
2 |
Correct |
215 ms |
11344 KB |
Output is correct |
3 |
Correct |
196 ms |
11344 KB |
Output is correct |
4 |
Correct |
422 ms |
11344 KB |
Output is correct |
5 |
Correct |
363 ms |
11344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
204 ms |
11516 KB |
Output is correct |
2 |
Correct |
395 ms |
11344 KB |
Output is correct |
3 |
Correct |
243 ms |
11372 KB |
Output is correct |
4 |
Correct |
421 ms |
11344 KB |
Output is correct |
5 |
Correct |
435 ms |
11344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
230 ms |
12880 KB |
Output is correct |
2 |
Correct |
243 ms |
12880 KB |
Output is correct |
3 |
Correct |
236 ms |
12880 KB |
Output is correct |
4 |
Correct |
512 ms |
12880 KB |
Output is correct |
5 |
Correct |
459 ms |
12880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
254 ms |
12880 KB |
Output is correct |
2 |
Correct |
488 ms |
12880 KB |
Output is correct |
3 |
Correct |
309 ms |
12752 KB |
Output is correct |
4 |
Correct |
517 ms |
12880 KB |
Output is correct |
5 |
Correct |
465 ms |
12880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
309 ms |
15952 KB |
Output is correct |
2 |
Correct |
304 ms |
15952 KB |
Output is correct |
3 |
Correct |
302 ms |
15952 KB |
Output is correct |
4 |
Correct |
648 ms |
15952 KB |
Output is correct |
5 |
Correct |
556 ms |
15952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
342 ms |
15952 KB |
Output is correct |
2 |
Correct |
546 ms |
16120 KB |
Output is correct |
3 |
Correct |
340 ms |
15952 KB |
Output is correct |
4 |
Correct |
625 ms |
15952 KB |
Output is correct |
5 |
Correct |
533 ms |
15952 KB |
Output is correct |