Submission #1093833

# Submission time Handle Problem Language Result Execution time Memory
1093833 2024-09-27T15:55:11 Z damamila Mobile (BOI12_mobile) C++14
0 / 100
597 ms 24660 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];
	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(6);
	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);
      |         ^
# 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 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Incorrect 3 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 1624 KB Output is correct
2 Incorrect 33 ms 2252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 2644 KB Output is correct
2 Incorrect 41 ms 2652 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 197 ms 8648 KB Output is correct
2 Correct 216 ms 12068 KB Output is correct
3 Correct 213 ms 11344 KB Output is correct
4 Incorrect 371 ms 13824 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 212 ms 12412 KB Output is correct
2 Incorrect 322 ms 10748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 231 ms 10132 KB Output is correct
2 Incorrect 258 ms 14420 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 255 ms 14928 KB Output is correct
2 Incorrect 378 ms 12880 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 286 ms 11856 KB Output is correct
2 Incorrect 303 ms 16724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 296 ms 17304 KB Output is correct
2 Incorrect 435 ms 14928 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 311 ms 13628 KB Output is correct
2 Incorrect 330 ms 19024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 374 ms 19796 KB Output is correct
2 Incorrect 501 ms 17236 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 378 ms 16956 KB Output is correct
2 Incorrect 418 ms 23744 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 420 ms 24660 KB Output is correct
2 Incorrect 597 ms 21332 KB Output isn't correct
3 Halted 0 ms 0 KB -