// include
#include<bits/stdc++.h>
using namespace std;
// define
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define eb emplace_back
#define upb upper_bound
#define lwb lower_bound
#define left VAN
#define right TAN
#define sz(a) (int)a.size()
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).begin(),(a).end()
#define sort_and_unique(a) sort(all(a));(a).resize(unique(all(a))-a.begin())
#define max_ max_element
#define min_ min_element
// another define
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mil = map<int, ll>;
using mli = map<ll, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
// random
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// templates
template<class X, class Y>
bool maximize(X &x, const Y &y) {
if (y > x) {
x = y;
return (true);
} else return (false);
}
template<class X, class Y>
bool minimize(X &x, const Y &y) {
if (y < x) {
x = y;
return (true);
} else return (false);
}
template<class T>
void print(const T &a, const int &l, const int &r) {
for (int i = l; i <= r; i++)
cout << a[i] << ' ';
cout << '\n';
}
// limit
const int oo = 2e9;
const int N = 1e6;
// function
void yesno(bool x) {
cout << (x ? "YES\n" : "NO\n");
}
// mem
ll L;
int n;
ld x[N + 5], y[N + 5];
bool ok(ld d) {
vector<pair<ld, ld>> s;
for (int i = 1; i <= n; i++) {
ld y0 = abs(y[i]);
if (y0 <= d) {
ld delta = sqrt(d * d - y0 * y0);
s.pub({x[i] - delta, x[i] + delta});
}
}
sort(all(s));
if (sz(s) == 0) return (false);
if (s[0].fi > 0.0) return (false);
ld r = 0.0;
for (int i = 0; i < sz(s); i++) {
if (r >= s[i].fi) maximize(r, s[i].se);
}
if (r >= L) return (true);
else return (false);
}
ld BS() {
ld l = 0.0, r = 2e9;
for (int _ = 1; _ <= 42; _++) {
ld mid = (l + r) / 2;
if (ok(mid))
r = mid;
else l = mid;
}
return (r);
}
void solve() {
cin >> n >> L;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
cout << fixed << setprecision(4) << BS() << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t = 1;
//cin >> t;
while (t--) solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
472 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
472 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
820 KB |
Output is correct |
2 |
Correct |
8 ms |
800 KB |
Output is correct |
3 |
Correct |
5 ms |
604 KB |
Output is correct |
4 |
Correct |
8 ms |
808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
1096 KB |
Output is correct |
2 |
Correct |
24 ms |
1232 KB |
Output is correct |
3 |
Correct |
26 ms |
1100 KB |
Output is correct |
4 |
Correct |
11 ms |
1120 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
1136 KB |
Output is correct |
2 |
Correct |
20 ms |
1132 KB |
Output is correct |
3 |
Correct |
25 ms |
1096 KB |
Output is correct |
4 |
Correct |
11 ms |
1136 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
1220 KB |
Output is correct |
2 |
Correct |
18 ms |
1132 KB |
Output is correct |
3 |
Correct |
30 ms |
1092 KB |
Output is correct |
4 |
Correct |
11 ms |
1148 KB |
Output is correct |
5 |
Correct |
13 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
223 ms |
10140 KB |
Output is correct |
2 |
Correct |
488 ms |
10496 KB |
Output is correct |
3 |
Correct |
276 ms |
6524 KB |
Output is correct |
4 |
Correct |
162 ms |
10476 KB |
Output is correct |
5 |
Correct |
183 ms |
6080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
246 ms |
10032 KB |
Output is correct |
2 |
Correct |
193 ms |
9788 KB |
Output is correct |
3 |
Correct |
208 ms |
10448 KB |
Output is correct |
4 |
Correct |
197 ms |
10304 KB |
Output is correct |
5 |
Correct |
152 ms |
11068 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
381 ms |
10800 KB |
Output is correct |
2 |
Correct |
472 ms |
10540 KB |
Output is correct |
3 |
Correct |
610 ms |
10720 KB |
Output is correct |
4 |
Correct |
117 ms |
12036 KB |
Output is correct |
5 |
Correct |
259 ms |
10928 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
480 ms |
12056 KB |
Output is correct |
2 |
Correct |
596 ms |
11880 KB |
Output is correct |
3 |
Correct |
758 ms |
11652 KB |
Output is correct |
4 |
Correct |
122 ms |
11984 KB |
Output is correct |
5 |
Correct |
263 ms |
11604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
491 ms |
12176 KB |
Output is correct |
2 |
Correct |
617 ms |
11848 KB |
Output is correct |
3 |
Correct |
773 ms |
10888 KB |
Output is correct |
4 |
Correct |
127 ms |
10816 KB |
Output is correct |
5 |
Correct |
257 ms |
10852 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1058 ms |
48416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1065 ms |
48256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1052 ms |
68544 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1067 ms |
68496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1057 ms |
71616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1077 ms |
71628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1039 ms |
74828 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1080 ms |
74748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1061 ms |
81020 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1038 ms |
80924 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |