Submission #1079725

# Submission time Handle Problem Language Result Execution time Memory
1079725 2024-08-28T23:12:49 Z EmmaXII Mobile (BOI12_mobile) C++17
65 / 100
280 ms 35408 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;
	ll L;
	cin >> N >> L;

	vector<ll> X(N);
	vector<ll> 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-y) * (r+y));
	};

	auto can_do = [&](double R) {
		double progress = 0.;
		for (int i=0;i<N;i++) {
			double hw = get_hw((double)Y[i], R);
			if (hw < 0) continue;

			double l = (double)X[i] - hw;
			double r = (double)X[i] + hw;
			if (l <= progress + 1e-6) progress = max(progress, r);
			if (progress >= (double)L) return true;
		}

		return false;
	};

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

	while (hi - lo > 1e-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 1 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 348 KB Output is correct
# 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 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1112 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2396 KB Output is correct
2 Correct 24 ms 2744 KB Output is correct
3 Correct 11 ms 1800 KB Output is correct
4 Correct 13 ms 2652 KB Output is correct
5 Correct 6 ms 1624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2140 KB Output is correct
2 Correct 12 ms 2140 KB Output is correct
3 Correct 12 ms 2652 KB Output is correct
4 Correct 14 ms 2716 KB Output is correct
5 Correct 17 ms 3096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 2392 KB Output is correct
2 Correct 19 ms 2524 KB Output is correct
3 Correct 16 ms 2396 KB Output is correct
4 Correct 20 ms 3164 KB Output is correct
5 Correct 12 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 3056 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2908 KB Output is correct
2 Correct 23 ms 2908 KB Output is correct
3 Correct 16 ms 2652 KB Output is correct
4 Correct 20 ms 3164 KB Output is correct
5 Correct 16 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 10576 KB Output is correct
2 Incorrect 117 ms 12360 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 125 ms 12880 KB Output is correct
2 Correct 159 ms 11860 KB Output is correct
3 Correct 88 ms 14164 KB Output is correct
4 Correct 94 ms 17496 KB Output is correct
5 Correct 82 ms 15440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 12532 KB Output is correct
2 Incorrect 162 ms 14932 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 156 ms 14932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 157 ms 14740 KB Output is correct
2 Incorrect 174 ms 16980 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 174 ms 11356 KB Output is correct
2 Correct 203 ms 11352 KB Output is correct
3 Correct 126 ms 19600 KB Output is correct
4 Correct 139 ms 24784 KB Output is correct
5 Correct 116 ms 21520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 12972 KB Output is correct
2 Incorrect 185 ms 12968 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 205 ms 13144 KB Output is correct
2 Correct 228 ms 13136 KB Output is correct
3 Correct 149 ms 22308 KB Output is correct
4 Correct 152 ms 28332 KB Output is correct
5 Correct 143 ms 24364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 231 ms 15960 KB Output is correct
2 Incorrect 237 ms 15960 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 269 ms 15964 KB Output is correct
2 Correct 280 ms 15960 KB Output is correct
3 Correct 185 ms 28240 KB Output is correct
4 Correct 194 ms 35408 KB Output is correct
5 Correct 159 ms 30800 KB Output is correct