Submission #974144

# Submission time Handle Problem Language Result Execution time Memory
974144 2024-05-02T23:12:37 Z AksLolCoding Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 31824 KB
#include <bits/stdc++.h>
using namespace std;

using ld = long double;
using ld2 = array<ld, 2>;

const ld diff = 1e-3;
int n;
ld h;
vector<ld2> pts;

ld2 range(ld dist, ld2& pt) {
	ld dx = sqrt(dist*dist - pt[1]*pt[1]);
	return {pt[0] - dx, pt[0] + dx};
}

bool check(ld dist) {
	ld left = 0;
	for (ld2& pt: pts) {
		ld2 r = range(dist, pt);
		if (r[0] <= left) left = max(left, r[1]);
	}
	return (left >= h);
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> h;
	pts.resize(n);
	for (auto& i: pts) cin >> i[0] >> i[1];

	// solve
	ld l = 0, r = 1.5e9, m;
	while (r - l > diff) {
		m = (r + l) / 2;
		if (check(m)) r = m;
		else l = m;
	}
	printf("%.3Lf\n", m);
}
# 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 1 ms 344 KB Output is correct
4 Correct 0 ms 348 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 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 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 5 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 604 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 5 ms 600 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 2648 KB Output is correct
2 Correct 40 ms 2652 KB Output is correct
3 Correct 32 ms 2140 KB Output is correct
4 Correct 69 ms 2648 KB Output is correct
5 Correct 40 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 2908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 42 ms 3164 KB Output is correct
2 Correct 46 ms 3040 KB Output is correct
3 Correct 49 ms 2904 KB Output is correct
4 Correct 103 ms 3568 KB Output is correct
5 Correct 72 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 3584 KB Output is correct
2 Correct 51 ms 3416 KB Output is correct
3 Correct 61 ms 3420 KB Output is correct
4 Correct 103 ms 3588 KB Output is correct
5 Correct 83 ms 3672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 3416 KB Output is correct
2 Correct 51 ms 3588 KB Output is correct
3 Correct 59 ms 3420 KB Output is correct
4 Correct 106 ms 3416 KB Output is correct
5 Correct 95 ms 3584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 16116 KB Output is correct
2 Correct 266 ms 16108 KB Output is correct
3 Correct 262 ms 16112 KB Output is correct
4 Correct 513 ms 15964 KB Output is correct
5 Correct 438 ms 16216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 284 ms 16112 KB Output is correct
2 Correct 395 ms 16112 KB Output is correct
3 Correct 297 ms 15964 KB Output is correct
4 Correct 502 ms 15964 KB Output is correct
5 Correct 455 ms 16112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 294 ms 19288 KB Output is correct
2 Correct 342 ms 19248 KB Output is correct
3 Correct 313 ms 19032 KB Output is correct
4 Correct 627 ms 19032 KB Output is correct
5 Correct 519 ms 19036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 327 ms 19292 KB Output is correct
2 Correct 466 ms 19036 KB Output is correct
3 Correct 370 ms 19288 KB Output is correct
4 Correct 629 ms 19036 KB Output is correct
5 Correct 539 ms 19248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 350 ms 22608 KB Output is correct
2 Correct 372 ms 22360 KB Output is correct
3 Correct 371 ms 22360 KB Output is correct
4 Correct 737 ms 22372 KB Output is correct
5 Correct 606 ms 22372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 380 ms 22368 KB Output is correct
2 Correct 577 ms 22368 KB Output is correct
3 Correct 443 ms 22364 KB Output is correct
4 Correct 711 ms 22372 KB Output is correct
5 Correct 622 ms 22616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 399 ms 25504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 444 ms 25508 KB Output is correct
2 Correct 617 ms 25680 KB Output is correct
3 Correct 489 ms 25508 KB Output is correct
4 Correct 841 ms 25512 KB Output is correct
5 Correct 754 ms 25436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 509 ms 31760 KB Output is correct
2 Correct 553 ms 31768 KB Output is correct
3 Correct 535 ms 31576 KB Output is correct
4 Execution timed out 1039 ms 31764 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 539 ms 31580 KB Output is correct
2 Correct 780 ms 31764 KB Output is correct
3 Correct 599 ms 31824 KB Output is correct
4 Execution timed out 1043 ms 31768 KB Time limit exceeded
5 Halted 0 ms 0 KB -