Submission #1079339

# Submission time Handle Problem Language Result Execution time Memory
1079339 2024-08-28T13:14:07 Z EmmaXII Mobile (BOI12_mobile) C++17
4 / 100
1000 ms 64732 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

#define all(x) x.begin(), x.end()


int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);

	int N;
	double L;
	cin >> N >> L;

	vector<double> X(N);
	vector<double> Y(N);
	for (int i=0;i<N;i++) cin >> X[i] >> Y[i];

	auto get_hw = [&](double y, double r) {
		if (abs(y) > r) return -1.0;
		return sqrt(r*r - y*y);
	};

	auto can_do = [&](double R) {
		vector<pair<double, double>> ivals;
		for (int i=0;i<N;i++) {
			double hw = get_hw(Y[i], R);
			if (hw < 0) continue;
			ivals.push_back({X[i] - hw, X[i] + hw});
		}
		// sort(all(ivals));
		double progress = 0.;
		for (auto [l, r] : ivals) {
			if (l > progress + 1e-5) return false;
			progress = max(progress, r);
		}

		return progress >= L;
	};

	double lo = 0;
	double hi = L + abs(X[0]) + abs(Y[0]);
	hi = hi*hi;
	for (int i=0;i<N;i++) {
		double nhi = max(
			X[i]*X[i] + Y[i]*Y[i],
			(X[i]-L)*(X[i]-L) + Y[i]*Y[i]
		);
		hi = min(nhi, hi);
	}
	hi = sqrt(hi);

	while (hi - lo > 5e-4) {
		double mid = (lo + hi) / 2;
		if (can_do(mid)) hi = mid;
		else lo = mid;
	}
	cout << setprecision(10);
	cout << lo << endl;

	return 0;
}
# 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 Correct 0 ms 344 KB Output is correct
# 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 Correct 1 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 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 464 KB Output is correct
2 Correct 4 ms 812 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Incorrect 2 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 5656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 3032 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 68 ms 6024 KB Output is correct
2 Correct 74 ms 6352 KB Output is correct
3 Correct 49 ms 4820 KB Output is correct
4 Incorrect 45 ms 4556 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 7320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 93 ms 7264 KB Output is correct
2 Correct 90 ms 7152 KB Output is correct
3 Correct 64 ms 6572 KB Output is correct
4 Incorrect 36 ms 4568 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 458 ms 28692 KB Output is correct
2 Incorrect 494 ms 32256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 514 ms 32560 KB Output is correct
2 Incorrect 400 ms 30948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 701 ms 41040 KB Output is correct
2 Incorrect 694 ms 45280 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 717 ms 45632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 805 ms 45028 KB Output is correct
2 Incorrect 799 ms 49948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 839 ms 50388 KB Output is correct
2 Incorrect 514 ms 48084 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 841 ms 49232 KB Output is correct
2 Incorrect 827 ms 54428 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 891 ms 55144 KB Output is correct
2 Incorrect 541 ms 52536 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 999 ms 56920 KB Output is correct
2 Execution timed out 1002 ms 63940 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1031 ms 64732 KB Time limit exceeded
2 Halted 0 ms 0 KB -