Submission #1013724

# Submission time Handle Problem Language Result Execution time Memory
1013724 2024-07-04T03:44:21 Z nrg_studio Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 51064 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<ld,ld>
#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);}

	auto check = [&](ld m)->bool {
		ld prev = 0;
		F0R(i,n) {
			ld dist = sqrt(m*m-(a[i].s)*(a[i].s));
			ld x1 = a[i].f-dist, x2 = a[i].f+dist;
			//if (x1 > d) {return (d>=prev);}
			//else if (x1 >= prev) {return true;}
			//else {prev = max(prev, x2);}
			if (x1 < prev) {prev = max(prev,x2);}
		} return (d>=prev);
	};
	ld l = 0, h = 1e9*5, m = (l+h)/2;
	ld 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 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 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 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 2 ms 416 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 5 ms 604 KB Output is correct
2 Correct 3 ms 684 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 664 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 668 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 7 ms 604 KB Output is correct
5 Correct 5 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 3420 KB Output is correct
2 Correct 42 ms 3916 KB Output is correct
3 Correct 35 ms 2652 KB Output is correct
4 Correct 87 ms 3932 KB Output is correct
5 Correct 44 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 3416 KB Output is correct
2 Correct 73 ms 3420 KB Output is correct
3 Correct 88 ms 3932 KB Output is correct
4 Correct 92 ms 3932 KB Output is correct
5 Correct 106 ms 4568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 3676 KB Output is correct
2 Correct 43 ms 4184 KB Output is correct
3 Correct 55 ms 3932 KB Output is correct
4 Correct 123 ms 5468 KB Output is correct
5 Correct 92 ms 3932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 4944 KB Output is correct
2 Correct 52 ms 4948 KB Output is correct
3 Correct 61 ms 4476 KB Output is correct
4 Correct 123 ms 5456 KB Output is correct
5 Correct 133 ms 4832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 4948 KB Output is correct
2 Correct 50 ms 4948 KB Output is correct
3 Correct 63 ms 4444 KB Output is correct
4 Correct 121 ms 5464 KB Output is correct
5 Correct 101 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 257 ms 20308 KB Output is correct
2 Correct 265 ms 23888 KB Output is correct
3 Correct 269 ms 23376 KB Output is correct
4 Correct 643 ms 25648 KB Output is correct
5 Correct 564 ms 22864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 241 ms 24292 KB Output is correct
2 Correct 484 ms 22608 KB Output is correct
3 Correct 328 ms 21840 KB Output is correct
4 Correct 615 ms 25296 KB Output is correct
5 Correct 554 ms 23388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 312 ms 24144 KB Output is correct
2 Correct 315 ms 28392 KB Output is correct
3 Correct 314 ms 27728 KB Output is correct
4 Correct 747 ms 30856 KB Output is correct
5 Correct 632 ms 26960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 295 ms 28940 KB Output is correct
2 Correct 546 ms 27224 KB Output is correct
3 Correct 372 ms 25940 KB Output is correct
4 Correct 741 ms 30944 KB Output is correct
5 Correct 677 ms 27728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 345 ms 28240 KB Output is correct
2 Correct 377 ms 32968 KB Output is correct
3 Correct 327 ms 32336 KB Output is correct
4 Correct 861 ms 35664 KB Output is correct
5 Correct 707 ms 31304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 359 ms 33732 KB Output is correct
2 Correct 639 ms 31588 KB Output is correct
3 Correct 449 ms 30540 KB Output is correct
4 Correct 864 ms 35664 KB Output is correct
5 Correct 770 ms 32340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 413 ms 32284 KB Output is correct
2 Correct 413 ms 37628 KB Output is correct
3 Correct 465 ms 36948 KB Output is correct
4 Execution timed out 1031 ms 41120 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 439 ms 38484 KB Output is correct
2 Correct 733 ms 35920 KB Output is correct
3 Correct 529 ms 34964 KB Output is correct
4 Execution timed out 1018 ms 40716 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 533 ms 40272 KB Output is correct
2 Correct 515 ms 47092 KB Output is correct
3 Correct 509 ms 46332 KB Output is correct
4 Execution timed out 1073 ms 50828 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 512 ms 48208 KB Output is correct
2 Correct 974 ms 45008 KB Output is correct
3 Correct 605 ms 43856 KB Output is correct
4 Execution timed out 1046 ms 51064 KB Time limit exceeded
5 Halted 0 ms 0 KB -