#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); }
ld 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 < 200; 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 |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
568 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
348 KB |
Output is correct |
2 |
Correct |
6 ms |
348 KB |
Output is correct |
3 |
Incorrect |
7 ms |
572 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
225 ms |
1496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
293 ms |
1496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
116 ms |
1500 KB |
Output is correct |
2 |
Incorrect |
26 ms |
1500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
1500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
108 ms |
1496 KB |
Output is correct |
2 |
Incorrect |
121 ms |
1612 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
713 ms |
4552 KB |
Output is correct |
2 |
Correct |
578 ms |
4820 KB |
Output is correct |
3 |
Correct |
586 ms |
6352 KB |
Output is correct |
4 |
Execution timed out |
1059 ms |
5948 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
581 ms |
5056 KB |
Output is correct |
2 |
Execution timed out |
1092 ms |
6340 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
830 ms |
9160 KB |
Output is correct |
2 |
Incorrect |
690 ms |
10280 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
685 ms |
10688 KB |
Output is correct |
2 |
Execution timed out |
1070 ms |
8900 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
872 ms |
9668 KB |
Output is correct |
2 |
Incorrect |
195 ms |
9160 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
212 ms |
9920 KB |
Output is correct |
2 |
Execution timed out |
1067 ms |
8640 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1055 ms |
10180 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
865 ms |
10692 KB |
Output is correct |
2 |
Execution timed out |
1062 ms |
10176 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1044 ms |
9256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
247 ms |
9412 KB |
Output is correct |
2 |
Execution timed out |
1077 ms |
10836 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |