답안 #477081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
477081 2021-09-30T06:14:44 Z qwerty1234 Mobile (BOI12_mobile) C++17
100 / 100
838 ms 16084 KB
#include <bits/stdc++.h>

#define ll long long

using namespace std;

bool check(double maxDist, vector<pair<double, double>> &transceivers, ll N, ll L) {
	double covered = 0;
	for (int i = 0; i < N; i++) {
		double ySquared = transceivers[i].second * transceivers[i].second;
		double hypoSquared = maxDist * maxDist;
		if (hypoSquared - ySquared < 0) {
			continue;
		}
		double x = sqrt(hypoSquared - ySquared);
		if (transceivers[i].first - x <= covered) {
			covered = max(covered, transceivers[i].first + x);
		}
	}
	return covered >= L;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll N, L;
	cin >> N >> L;
	vector<pair<double, double>> transceivers(N);
	for (int i = 0; i < N; i++) cin >> transceivers[i].first >> transceivers[i].second;
	double l = 0;
	double r = 1e18;
	double ans = 0;
	while (r - l >= 0.001) {
		double mid = l + (r - l) / 2;
		// cout << l << ' ' << r << ' ' << mid << '\n';
		if (check(mid, transceivers, N, L)) {
			r = mid;
			ans = mid;
		} else {
			l = mid;
		}
	}
	printf("%0.4lf\n", ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 5 ms 388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 396 KB Output is correct
2 Correct 5 ms 392 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 4 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 388 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 5 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 1484 KB Output is correct
2 Correct 56 ms 1484 KB Output is correct
3 Correct 48 ms 1144 KB Output is correct
4 Correct 55 ms 1484 KB Output is correct
5 Correct 35 ms 1100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 1484 KB Output is correct
2 Correct 50 ms 1476 KB Output is correct
3 Correct 59 ms 1484 KB Output is correct
4 Correct 59 ms 1548 KB Output is correct
5 Correct 77 ms 1612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 1612 KB Output is correct
2 Correct 71 ms 1484 KB Output is correct
3 Correct 60 ms 1732 KB Output is correct
4 Correct 85 ms 1868 KB Output is correct
5 Correct 65 ms 1612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 1872 KB Output is correct
2 Correct 78 ms 1872 KB Output is correct
3 Correct 70 ms 1868 KB Output is correct
4 Correct 85 ms 1868 KB Output is correct
5 Correct 72 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 1876 KB Output is correct
2 Correct 74 ms 1868 KB Output is correct
3 Correct 75 ms 1868 KB Output is correct
4 Correct 90 ms 1868 KB Output is correct
5 Correct 78 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 370 ms 8144 KB Output is correct
2 Correct 397 ms 8144 KB Output is correct
3 Correct 391 ms 8260 KB Output is correct
4 Correct 404 ms 8148 KB Output is correct
5 Correct 360 ms 8140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 424 ms 8260 KB Output is correct
2 Correct 432 ms 8144 KB Output is correct
3 Correct 333 ms 8140 KB Output is correct
4 Correct 400 ms 8140 KB Output is correct
5 Correct 356 ms 8260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 406 ms 9696 KB Output is correct
2 Correct 480 ms 9700 KB Output is correct
3 Correct 471 ms 9704 KB Output is correct
4 Correct 541 ms 9696 KB Output is correct
5 Correct 423 ms 9676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 533 ms 9692 KB Output is correct
2 Correct 500 ms 9800 KB Output is correct
3 Correct 450 ms 9700 KB Output is correct
4 Correct 499 ms 9676 KB Output is correct
5 Correct 451 ms 9676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 489 ms 11212 KB Output is correct
2 Correct 557 ms 11264 KB Output is correct
3 Correct 530 ms 11260 KB Output is correct
4 Correct 575 ms 11332 KB Output is correct
5 Correct 488 ms 11264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 567 ms 11268 KB Output is correct
2 Correct 576 ms 11264 KB Output is correct
3 Correct 497 ms 11212 KB Output is correct
4 Correct 585 ms 11260 KB Output is correct
5 Correct 513 ms 11212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 573 ms 12868 KB Output is correct
2 Correct 659 ms 12832 KB Output is correct
3 Correct 632 ms 12828 KB Output is correct
4 Correct 665 ms 12844 KB Output is correct
5 Correct 591 ms 12836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 686 ms 12832 KB Output is correct
2 Correct 656 ms 12844 KB Output is correct
3 Correct 560 ms 12832 KB Output is correct
4 Correct 654 ms 12828 KB Output is correct
5 Correct 576 ms 12832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 672 ms 15960 KB Output is correct
2 Correct 788 ms 15948 KB Output is correct
3 Correct 823 ms 15948 KB Output is correct
4 Correct 838 ms 16068 KB Output is correct
5 Correct 779 ms 15972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 793 ms 15956 KB Output is correct
2 Correct 813 ms 15960 KB Output is correct
3 Correct 704 ms 16084 KB Output is correct
4 Correct 827 ms 16068 KB Output is correct
5 Correct 746 ms 15968 KB Output is correct