Submission #1093829

# Submission time Handle Problem Language Result Execution time Memory
1093829 2024-09-27T15:50:08 Z damamila Mobile (BOI12_mobile) C++14
0 / 100
466 ms 23636 KB
#include <bits/stdc++.h>

using namespace std;

//~ #define int long long

int n, 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 = 1e9, 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;
	}
	solve();
}

Compilation message

mobile.cpp: In function 'std::pair<double, double> circle_intersection(int, double)':
mobile.cpp:11:7: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   11 |  auto [x, y] = points[i];
      |       ^
mobile.cpp: In function 'void solve()':
mobile.cpp:29:9: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   29 |    auto [x1, x2] = circle_intersection(i, m);
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 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 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 2060 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 1700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1624 KB Output is correct
2 Incorrect 24 ms 2268 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 2644 KB Output is correct
2 Incorrect 29 ms 2648 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 131 ms 7948 KB Output is correct
2 Correct 145 ms 11856 KB Output is correct
3 Correct 145 ms 11512 KB Output is correct
4 Incorrect 312 ms 13904 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 159 ms 11024 KB Output is correct
2 Incorrect 260 ms 10832 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 155 ms 9736 KB Output is correct
2 Incorrect 182 ms 14340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 179 ms 13144 KB Output is correct
2 Incorrect 300 ms 13060 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 191 ms 10900 KB Output is correct
2 Incorrect 206 ms 16532 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 211 ms 14928 KB Output is correct
2 Incorrect 350 ms 14932 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 205 ms 12384 KB Output is correct
2 Incorrect 238 ms 19028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 229 ms 17236 KB Output is correct
2 Incorrect 396 ms 17236 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 268 ms 15424 KB Output is correct
2 Incorrect 281 ms 23636 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 294 ms 21072 KB Output is correct
2 Incorrect 466 ms 21436 KB Output isn't correct
3 Halted 0 ms 0 KB -