답안 #1093841

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1093841 2024-09-27T16:05:16 Z damamila Mobile (BOI12_mobile) C++14
100 / 100
624 ms 35424 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int n;
double l;
vector<pair<int, int>> points;

pair<double, double> circle_intersection(int i, double r) {
	auto [x, y] = points[i];
	if (y > r) return {-1, -1}; //too far away
	double r2 = r*r;
	double y2 = y*y;
	double tmp = sqrt(r2-y2);
	double x1 = x-tmp;
	double x2 = x+tmp;
	return {x1, x2};
}

void solve() {
	double ub = 1.5e9, lb = 1;
	double m;
	while (lb+0.001 < ub) {
		m = (lb+ub)/2;
		double reach = 0;
		bool ja = 1;
		for (int i = 0; i < n; i++) {
			auto [x1, x2] = circle_intersection(i, m);
			if (reach < x1) continue;
			reach = max(reach, x2);
		}
		if (reach < l) ja = 0;
		if (ja) ub = m;
		else lb = m;
	}
	cout << lb << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);  
	cin >> n >> l;
	cout << fixed << setprecision(4);
	points = vector<pair<int, int>> (n);
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		points[i] = {x, y};
	}
	//~ sort(points.begin(), points.end());
	solve();
}

Compilation message

mobile.cpp: In function 'std::pair<double, double> circle_intersection(long long int, double)':
mobile.cpp:12:7: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   12 |  auto [x, y] = points[i];
      |       ^
mobile.cpp: In function 'void solve()':
mobile.cpp:30:9: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |    auto [x1, x2] = circle_intersection(i, m);
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 448 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 2436 KB Output is correct
2 Correct 18 ms 2648 KB Output is correct
3 Correct 13 ms 1940 KB Output is correct
4 Correct 39 ms 2652 KB Output is correct
5 Correct 11 ms 1628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 2392 KB Output is correct
2 Correct 32 ms 2140 KB Output is correct
3 Correct 39 ms 2648 KB Output is correct
4 Correct 41 ms 2908 KB Output is correct
5 Correct 48 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 2392 KB Output is correct
2 Correct 23 ms 2904 KB Output is correct
3 Correct 21 ms 2652 KB Output is correct
4 Correct 62 ms 3932 KB Output is correct
5 Correct 33 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 3416 KB Output is correct
2 Correct 24 ms 3440 KB Output is correct
3 Correct 21 ms 2908 KB Output is correct
4 Correct 60 ms 3932 KB Output is correct
5 Correct 47 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 3420 KB Output is correct
2 Correct 24 ms 3420 KB Output is correct
3 Correct 25 ms 2912 KB Output is correct
4 Correct 60 ms 3956 KB Output is correct
5 Correct 48 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 12500 KB Output is correct
2 Correct 135 ms 15948 KB Output is correct
3 Correct 124 ms 15312 KB Output is correct
4 Correct 300 ms 17748 KB Output is correct
5 Correct 246 ms 14932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 127 ms 16288 KB Output is correct
2 Correct 179 ms 14672 KB Output is correct
3 Correct 107 ms 13904 KB Output is correct
4 Correct 296 ms 17488 KB Output is correct
5 Correct 259 ms 15556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 127 ms 14932 KB Output is correct
2 Correct 148 ms 19028 KB Output is correct
3 Correct 144 ms 18512 KB Output is correct
4 Correct 368 ms 21588 KB Output is correct
5 Correct 289 ms 17768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 19400 KB Output is correct
2 Correct 209 ms 17748 KB Output is correct
3 Correct 129 ms 16596 KB Output is correct
4 Correct 372 ms 21588 KB Output is correct
5 Correct 307 ms 18768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 152 ms 17232 KB Output is correct
2 Correct 170 ms 22100 KB Output is correct
3 Correct 171 ms 21332 KB Output is correct
4 Correct 428 ms 24700 KB Output is correct
5 Correct 329 ms 20308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 22612 KB Output is correct
2 Correct 243 ms 20560 KB Output is correct
3 Correct 151 ms 19536 KB Output is correct
4 Correct 427 ms 24568 KB Output is correct
5 Correct 364 ms 21376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 19796 KB Output is correct
2 Correct 205 ms 25240 KB Output is correct
3 Correct 192 ms 24404 KB Output is correct
4 Correct 480 ms 28496 KB Output is correct
5 Correct 403 ms 23976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 198 ms 25880 KB Output is correct
2 Correct 260 ms 23064 KB Output is correct
3 Correct 172 ms 22352 KB Output is correct
4 Correct 506 ms 28192 KB Output is correct
5 Correct 427 ms 24404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 224 ms 24660 KB Output is correct
2 Correct 250 ms 31056 KB Output is correct
3 Correct 239 ms 30544 KB Output is correct
4 Correct 624 ms 35156 KB Output is correct
5 Correct 501 ms 29660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 251 ms 31568 KB Output is correct
2 Correct 323 ms 27928 KB Output is correct
3 Correct 223 ms 28240 KB Output is correct
4 Correct 621 ms 35424 KB Output is correct
5 Correct 529 ms 30800 KB Output is correct