/**
* title: Mobile
**/
#include <bits/stdc++.h>
using namespace std;
template <class T> istream &operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) { auto sep = ""; for (auto &x : v) os << exchange(sep, " ") << x; return os; }
template <class T> vector<T> &operator+=(vector<T> &v, const T &a) { for (auto &x : v) x += a; return v; }
template <class T> vector<T> &operator-=(vector<T> &v, const T &a) { for (auto &x : v) x -= a; return v; }
template <class T, class U> inline bool chmax(T &a, const U &b) { return (a < b ? a = b, 1 : 0); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return (b < a ? a = b, 1 : 0); }
#define si(x) int(x.size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
using ll = long long;
constexpr int inf = 1001001001;
constexpr long long infll = 4004004004004004004LL;
constexpr double eps = 1e-5;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, L;
cin >> N >> L;
vector<int> X(N), Y(N);
for (int i = 0; i < N; i++) {
cin >> X[i] >> Y[i];
}
auto valid = [&](double d) {
double p = 0;
for (int i = 0; i < N; i++) {
double t = sqrt(d * d - (ll)Y[i] * Y[i]);
double lhs = X[i] - t, rhs = X[i] + t;
if (p >= lhs) {
chmax(p, rhs);
}
}
return p >= L;
};
double l = 0, r = inf * 2;
while (r - l > eps) {
double mid = (l + r) / 2;
valid(mid) ? r = mid : l = mid;
}
cout << fixed << setprecision(10) << l << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
860 KB |
Output is correct |
2 |
Correct |
20 ms |
1072 KB |
Output is correct |
3 |
Correct |
17 ms |
1368 KB |
Output is correct |
4 |
Correct |
26 ms |
2140 KB |
Output is correct |
5 |
Correct |
14 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
860 KB |
Output is correct |
2 |
Correct |
22 ms |
856 KB |
Output is correct |
3 |
Correct |
26 ms |
860 KB |
Output is correct |
4 |
Correct |
27 ms |
2136 KB |
Output is correct |
5 |
Correct |
31 ms |
2548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1112 KB |
Output is correct |
2 |
Correct |
22 ms |
1112 KB |
Output is correct |
3 |
Correct |
23 ms |
2008 KB |
Output is correct |
4 |
Correct |
37 ms |
3164 KB |
Output is correct |
5 |
Correct |
31 ms |
2068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
1252 KB |
Output is correct |
2 |
Correct |
25 ms |
1256 KB |
Output is correct |
3 |
Correct |
27 ms |
2280 KB |
Output is correct |
4 |
Correct |
39 ms |
3160 KB |
Output is correct |
5 |
Correct |
34 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1116 KB |
Output is correct |
2 |
Correct |
26 ms |
1116 KB |
Output is correct |
3 |
Correct |
25 ms |
2284 KB |
Output is correct |
4 |
Correct |
39 ms |
3164 KB |
Output is correct |
5 |
Correct |
33 ms |
2384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
115 ms |
4432 KB |
Output is correct |
2 |
Correct |
138 ms |
4360 KB |
Output is correct |
3 |
Correct |
130 ms |
11600 KB |
Output is correct |
4 |
Correct |
183 ms |
13904 KB |
Output is correct |
5 |
Correct |
165 ms |
11344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
134 ms |
4364 KB |
Output is correct |
2 |
Correct |
233 ms |
10836 KB |
Output is correct |
3 |
Correct |
136 ms |
10064 KB |
Output is correct |
4 |
Correct |
178 ms |
13648 KB |
Output is correct |
5 |
Correct |
174 ms |
11684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
5144 KB |
Output is correct |
2 |
Correct |
154 ms |
4956 KB |
Output is correct |
3 |
Correct |
157 ms |
13852 KB |
Output is correct |
4 |
Correct |
224 ms |
17048 KB |
Output is correct |
5 |
Correct |
197 ms |
12932 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
159 ms |
5144 KB |
Output is correct |
2 |
Correct |
274 ms |
12972 KB |
Output is correct |
3 |
Correct |
155 ms |
11860 KB |
Output is correct |
4 |
Correct |
221 ms |
16724 KB |
Output is correct |
5 |
Correct |
204 ms |
13844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
171 ms |
5924 KB |
Output is correct |
2 |
Correct |
182 ms |
5928 KB |
Output is correct |
3 |
Correct |
179 ms |
15952 KB |
Output is correct |
4 |
Correct |
260 ms |
19284 KB |
Output is correct |
5 |
Correct |
301 ms |
14972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
186 ms |
5928 KB |
Output is correct |
2 |
Correct |
305 ms |
15016 KB |
Output is correct |
3 |
Correct |
189 ms |
14320 KB |
Output is correct |
4 |
Correct |
259 ms |
19324 KB |
Output is correct |
5 |
Correct |
240 ms |
16072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
185 ms |
6492 KB |
Output is correct |
2 |
Correct |
209 ms |
13116 KB |
Output is correct |
3 |
Correct |
214 ms |
18356 KB |
Output is correct |
4 |
Correct |
293 ms |
22192 KB |
Output is correct |
5 |
Correct |
266 ms |
17744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
211 ms |
6740 KB |
Output is correct |
2 |
Correct |
348 ms |
17288 KB |
Output is correct |
3 |
Correct |
222 ms |
16460 KB |
Output is correct |
4 |
Correct |
432 ms |
22096 KB |
Output is correct |
5 |
Correct |
267 ms |
18372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
227 ms |
8284 KB |
Output is correct |
2 |
Correct |
267 ms |
16288 KB |
Output is correct |
3 |
Correct |
258 ms |
22612 KB |
Output is correct |
4 |
Correct |
374 ms |
27500 KB |
Output is correct |
5 |
Correct |
341 ms |
21840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
269 ms |
8284 KB |
Output is correct |
2 |
Correct |
431 ms |
21316 KB |
Output is correct |
3 |
Correct |
273 ms |
20444 KB |
Output is correct |
4 |
Correct |
379 ms |
27640 KB |
Output is correct |
5 |
Correct |
342 ms |
23236 KB |
Output is correct |