답안 #1093836

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1093836 2024-09-27T15:58:54 Z damamila Mobile (BOI12_mobile) C++14
0 / 100
508 ms 24528 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;
	if (x2 < x1) swap(x1, x2);
	return {x1, x2};
}

void solve() {
	double ub = 1e18, lb = 0;
	double m;
	while (lb+0.00001 < 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+0.0000001 < x1) ja = 0;
			reach = max(reach, x2);
		}
		if (reach+0.0000001 < l) ja = 0;
		if (ja) {
			ub = m;
		} else {
			lb = m+0.00001;
		}
	}
	cout << ub << 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++) {
		cin >> points[i].first >> points[i].second;
		points[i].second = abs(points[i].second);
	}
	sort(points.begin(), points.end());
	solve();
}

Compilation message

mobile.cpp: In function 'std::pair<double, double> circle_intersection(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:31:9: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   31 |    auto [x1, x2] = circle_intersection(i, m);
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Incorrect 2 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 1828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 1784 KB Output is correct
2 Incorrect 33 ms 2140 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 2524 KB Output is correct
2 Incorrect 40 ms 2648 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 180 ms 8564 KB Output is correct
2 Correct 205 ms 11892 KB Output is correct
3 Correct 241 ms 11348 KB Output is correct
4 Incorrect 171 ms 13756 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 204 ms 12368 KB Output is correct
2 Incorrect 275 ms 10832 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 228 ms 10068 KB Output is correct
2 Incorrect 231 ms 14408 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 242 ms 14976 KB Output is correct
2 Incorrect 315 ms 12948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 260 ms 11944 KB Output is correct
2 Incorrect 281 ms 16536 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 279 ms 17232 KB Output is correct
2 Incorrect 362 ms 15080 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 290 ms 13492 KB Output is correct
2 Incorrect 323 ms 18980 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 19796 KB Output is correct
2 Incorrect 436 ms 17488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 413 ms 16976 KB Output is correct
2 Incorrect 401 ms 23792 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 411 ms 24528 KB Output is correct
2 Incorrect 508 ms 21332 KB Output isn't correct
3 Halted 0 ms 0 KB -