# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1013732 |
2024-07-04T04:37:37 Z |
nrg_studio |
Mobile (BOI12_mobile) |
C++17 |
|
464 ms |
30804 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define FOR(i, a, b, s) for (int i = (a); i < (b); i += s)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define pii pair<double,double>
#define mp make_pair
#define f first
#define s second
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int n, d; cin >> n >> d;
pii a[n];
F0R(i,n) {cin >> a[i].f >> a[i].s; a[i].s=abs(a[i].s);}
//sort(a,a+n);
auto check = [&](double m)->bool {
double prev = 0;
F0R(i,n) {
double dist = sqrt(m*m-(a[i].s)*(a[i].s));
double x1 = a[i].f-dist, x2 = a[i].f+dist;
/*if (x1 > d) {return (d>=prev);}
else if (x1 >= prev) {return true;}
prev = max(prev, x2);*/
if (x1 < prev) {prev = max(prev,x2);}
} return (d>=prev);
};
double l = 0, h = 1e9*3, m = (l+h)/2;
double ans;
cout << fixed << setprecision(4);
while (l <= h-1e-4) {
if (check(m)) {
l = m; ans = m;
} else {h = m;}
m = (l+h)/2;
}
cout << ans << '\n';
}
# |
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 |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 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 |
496 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
528 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
2 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 |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
532 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
1600 KB |
Output is correct |
2 |
Correct |
29 ms |
1628 KB |
Output is correct |
3 |
Correct |
20 ms |
1116 KB |
Output is correct |
4 |
Correct |
34 ms |
1372 KB |
Output is correct |
5 |
Correct |
19 ms |
1112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
1624 KB |
Output is correct |
2 |
Correct |
32 ms |
1368 KB |
Output is correct |
3 |
Correct |
33 ms |
1628 KB |
Output is correct |
4 |
Correct |
34 ms |
1624 KB |
Output is correct |
5 |
Correct |
39 ms |
1628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
1624 KB |
Output is correct |
2 |
Correct |
31 ms |
1628 KB |
Output is correct |
3 |
Correct |
38 ms |
1628 KB |
Output is correct |
4 |
Correct |
63 ms |
1984 KB |
Output is correct |
5 |
Correct |
41 ms |
1624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
1884 KB |
Output is correct |
2 |
Correct |
37 ms |
1884 KB |
Output is correct |
3 |
Correct |
33 ms |
1880 KB |
Output is correct |
4 |
Correct |
44 ms |
1884 KB |
Output is correct |
5 |
Correct |
40 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
1884 KB |
Output is correct |
2 |
Correct |
42 ms |
1884 KB |
Output is correct |
3 |
Correct |
36 ms |
1884 KB |
Output is correct |
4 |
Correct |
48 ms |
1992 KB |
Output is correct |
5 |
Correct |
50 ms |
1884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
182 ms |
8256 KB |
Output is correct |
2 |
Correct |
191 ms |
8256 KB |
Output is correct |
3 |
Correct |
191 ms |
8252 KB |
Output is correct |
4 |
Correct |
225 ms |
8028 KB |
Output is correct |
5 |
Correct |
230 ms |
8024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
8024 KB |
Output is correct |
2 |
Correct |
272 ms |
8028 KB |
Output is correct |
3 |
Correct |
185 ms |
8252 KB |
Output is correct |
4 |
Correct |
240 ms |
8260 KB |
Output is correct |
5 |
Correct |
208 ms |
8276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
210 ms |
9820 KB |
Output is correct |
2 |
Correct |
240 ms |
9816 KB |
Output is correct |
3 |
Correct |
222 ms |
9824 KB |
Output is correct |
4 |
Correct |
306 ms |
9820 KB |
Output is correct |
5 |
Correct |
242 ms |
9824 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
229 ms |
9820 KB |
Output is correct |
2 |
Correct |
312 ms |
9824 KB |
Output is correct |
3 |
Correct |
218 ms |
9828 KB |
Output is correct |
4 |
Correct |
273 ms |
9820 KB |
Output is correct |
5 |
Correct |
260 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
245 ms |
11356 KB |
Output is correct |
2 |
Correct |
285 ms |
11388 KB |
Output is correct |
3 |
Correct |
257 ms |
11384 KB |
Output is correct |
4 |
Correct |
341 ms |
11600 KB |
Output is correct |
5 |
Correct |
276 ms |
11388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
274 ms |
11352 KB |
Output is correct |
2 |
Correct |
350 ms |
11356 KB |
Output is correct |
3 |
Correct |
262 ms |
11388 KB |
Output is correct |
4 |
Correct |
311 ms |
11352 KB |
Output is correct |
5 |
Correct |
331 ms |
11356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
286 ms |
12956 KB |
Output is correct |
2 |
Correct |
319 ms |
12952 KB |
Output is correct |
3 |
Correct |
305 ms |
12968 KB |
Output is correct |
4 |
Correct |
407 ms |
12952 KB |
Output is correct |
5 |
Correct |
374 ms |
13136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
13140 KB |
Output is correct |
2 |
Correct |
387 ms |
12888 KB |
Output is correct |
3 |
Correct |
294 ms |
12888 KB |
Output is correct |
4 |
Correct |
423 ms |
12892 KB |
Output is correct |
5 |
Correct |
322 ms |
12956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
341 ms |
15964 KB |
Output is correct |
2 |
Correct |
420 ms |
15960 KB |
Output is correct |
3 |
Correct |
354 ms |
15960 KB |
Output is correct |
4 |
Correct |
391 ms |
15964 KB |
Output is correct |
5 |
Correct |
443 ms |
29508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
381 ms |
15960 KB |
Output is correct |
2 |
Correct |
455 ms |
15960 KB |
Output is correct |
3 |
Correct |
358 ms |
16080 KB |
Output is correct |
4 |
Correct |
464 ms |
15960 KB |
Output is correct |
5 |
Correct |
431 ms |
30804 KB |
Output is correct |