답안 #1093837

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1093837 2024-09-27T16:01:32 Z damamila Mobile (BOI12_mobile) C++14
0 / 100
446 ms 21076 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 = 1e18, lb = 0;
	double m;
	while (lb+0.0001 < 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) ja = 0;
			reach = max(reach, x2);
		}
		if (reach < l) ja = 0;
		if (ja) {
			ub = m;
		} else {
			lb = m;
		}
	}
	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: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 1 ms 344 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 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 564 KB Output is correct
3 Incorrect 2 ms 532 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 1808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 1624 KB Output is correct
2 Incorrect 29 ms 2136 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 2744 KB Output is correct
2 Incorrect 47 ms 2648 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 163 ms 8344 KB Output is correct
2 Correct 189 ms 11364 KB Output is correct
3 Correct 204 ms 11276 KB Output is correct
4 Incorrect 166 ms 13136 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 180 ms 11856 KB Output is correct
2 Incorrect 260 ms 10360 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 195 ms 10264 KB Output is correct
2 Incorrect 215 ms 13720 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 216 ms 13908 KB Output is correct
2 Incorrect 312 ms 12112 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 237 ms 11352 KB Output is correct
2 Incorrect 262 ms 15908 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 277 ms 16660 KB Output is correct
2 Incorrect 335 ms 14416 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 263 ms 13368 KB Output is correct
2 Incorrect 288 ms 17744 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 299 ms 18868 KB Output is correct
2 Incorrect 387 ms 15104 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 337 ms 15188 KB Output is correct
2 Incorrect 378 ms 20120 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 372 ms 21076 KB Output is correct
2 Incorrect 446 ms 18516 KB Output isn't correct
3 Halted 0 ms 0 KB -