#include <iostream>
#include <fstream>
#include <iomanip>
#include <stack>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fileTesting ifstream fileIn("input.txt"); cin.rdbuf(fileIn.rdbuf()); ofstream fileOut("output.txt"); cout.rdbuf(fileOut.rdbuf());
#define endl '\n'
#define print(x) for (auto i : x) cout << i << ' '; cout << endl
#define nloop(a, n) for (ll i = a; i < n; i++)
#define debug(x) cerr << #x << " is " << x << endl
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
const ll maxN = 1e9;
const ll mod = 1e9 + 7;
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b);}
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll n, len;
vector<pii> points;
ld check(ld r) {
ld cl = 0, cr = 0;
for (auto &p : points)
{
ld d = sqrt(pow(r, 2) - pow(p.second, 2));
if (p.first - d > cr)
return 0;
else {
cl = min(cl, p.first - d);
cr = max(cr, p.first + d);
}
}
if (cl <= 0 && cr >= len)
return 1;
return 0;
}
void solution() {
cin >> n >> len;
for (ll i = 0; i < n; i++) {
ll x, y;
cin >> x >> y;
points.push_back(make_pair(x, y));
}
ld l = 0, r = len + 1, m;
for (ll i = 0; i < 60; i++) {
m = (l + r) / 2;
if (check(m))
r = m;
else
l = m;
}
cout << fixed << setprecision(6) << r << endl;
}
int main() {
FastIO
ll t = 1;
// cin >> t;
while (t--) {
solution();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
564 KB |
Output is correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
87 ms |
1516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
110 ms |
1392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
1500 KB |
Output is correct |
2 |
Incorrect |
28 ms |
1496 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
1540 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
1500 KB |
Output is correct |
2 |
Incorrect |
31 ms |
1500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
259 ms |
5344 KB |
Output is correct |
2 |
Correct |
167 ms |
5640 KB |
Output is correct |
3 |
Correct |
158 ms |
11472 KB |
Output is correct |
4 |
Incorrect |
740 ms |
13916 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
118 ms |
4812 KB |
Output is correct |
2 |
Incorrect |
605 ms |
10932 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
316 ms |
9660 KB |
Output is correct |
2 |
Incorrect |
239 ms |
9696 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
184 ms |
10288 KB |
Output is correct |
2 |
Incorrect |
735 ms |
17432 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
347 ms |
9292 KB |
Output is correct |
2 |
Incorrect |
181 ms |
8896 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
186 ms |
9916 KB |
Output is correct |
2 |
Incorrect |
778 ms |
16332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
364 ms |
8892 KB |
Output is correct |
2 |
Incorrect |
188 ms |
10684 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
10428 KB |
Output is correct |
2 |
Incorrect |
916 ms |
17996 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
429 ms |
10692 KB |
Output is correct |
2 |
Incorrect |
256 ms |
10688 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
225 ms |
10692 KB |
Output is correct |
2 |
Incorrect |
961 ms |
21432 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |