Submission #1079327

# Submission time Handle Problem Language Result Execution time Memory
1079327 2024-08-28T13:06:05 Z EmmaXII Mobile (BOI12_mobile) C++17
31 / 100
1000 ms 64660 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) return false;
			progress = max(progress, r);
		}

		return progress >= L;
	};

	double lo = 0;
	double hi = L + abs(X[0]) + abs(Y[0]);
	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);
	}

	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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 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 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 624 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 3 ms 464 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 8 ms 812 KB Output is correct
3 Correct 8 ms 604 KB Output is correct
4 Correct 3 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 7 ms 812 KB Output is correct
3 Correct 7 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 892 KB Output is correct
2 Correct 6 ms 812 KB Output is correct
3 Correct 8 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 5700 KB Output is correct
2 Correct 183 ms 5992 KB Output is correct
3 Correct 97 ms 3600 KB Output is correct
4 Correct 41 ms 4828 KB Output is correct
5 Correct 21 ms 3016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 4568 KB Output is correct
2 Correct 35 ms 4300 KB Output is correct
3 Correct 39 ms 5076 KB Output is correct
4 Correct 42 ms 5012 KB Output is correct
5 Correct 45 ms 5332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 5972 KB Output is correct
2 Correct 200 ms 6276 KB Output is correct
3 Correct 230 ms 5800 KB Output is correct
4 Incorrect 55 ms 6100 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 212 ms 7236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 158 ms 7248 KB Output is correct
2 Correct 256 ms 7080 KB Output is correct
3 Correct 275 ms 6272 KB Output is correct
4 Incorrect 53 ms 6092 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 755 ms 28752 KB Output is correct
2 Execution timed out 1102 ms 32028 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1031 ms 32536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 40884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 45616 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 44892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1022 ms 50352 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 48880 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 55168 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1014 ms 56864 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 64660 KB Time limit exceeded
2 Halted 0 ms 0 KB -