Submission #1079732

# Submission time Handle Problem Language Result Execution time Memory
1079732 2024-08-28T23:23:00 Z EmmaXII Mobile (BOI12_mobile) C++17
65 / 100
296 ms 35292 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 = 1;
	double hi = 2e9;

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

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 600 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 520 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 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 2 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 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 584 KB Output is correct
2 Correct 2 ms 608 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 2392 KB Output is correct
2 Correct 14 ms 2652 KB Output is correct
3 Correct 8 ms 1884 KB Output is correct
4 Correct 17 ms 2768 KB Output is correct
5 Correct 6 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2260 KB Output is correct
2 Correct 12 ms 2376 KB Output is correct
3 Correct 15 ms 2652 KB Output is correct
4 Correct 16 ms 2916 KB Output is correct
5 Correct 17 ms 3092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 2468 KB Output is correct
2 Correct 22 ms 2916 KB Output is correct
3 Correct 15 ms 2652 KB Output is correct
4 Correct 25 ms 3976 KB Output is correct
5 Correct 15 ms 2612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 3524 KB Output is correct
2 Correct 21 ms 3444 KB Output is correct
3 Correct 20 ms 3044 KB Output is correct
4 Correct 25 ms 3928 KB Output is correct
5 Correct 18 ms 3304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 12564 KB Output is correct
2 Incorrect 102 ms 15936 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 129 ms 16344 KB Output is correct
2 Correct 185 ms 14676 KB Output is correct
3 Correct 79 ms 13904 KB Output is correct
4 Correct 109 ms 17492 KB Output is correct
5 Correct 103 ms 15424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 139 ms 15004 KB Output is correct
2 Incorrect 119 ms 18924 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 147 ms 19560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 158 ms 17284 KB Output is correct
2 Incorrect 144 ms 22236 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 151 ms 22928 KB Output is correct
2 Correct 228 ms 20480 KB Output is correct
3 Correct 142 ms 19592 KB Output is correct
4 Correct 154 ms 24580 KB Output is correct
5 Correct 117 ms 21328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 182 ms 19796 KB Output is correct
2 Incorrect 176 ms 25112 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 180 ms 26136 KB Output is correct
2 Correct 230 ms 23376 KB Output is correct
3 Correct 139 ms 22300 KB Output is correct
4 Correct 204 ms 28244 KB Output is correct
5 Correct 131 ms 24404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 237 ms 24660 KB Output is correct
2 Incorrect 164 ms 31468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 227 ms 32728 KB Output is correct
2 Correct 296 ms 29264 KB Output is correct
3 Correct 155 ms 28240 KB Output is correct
4 Correct 218 ms 35292 KB Output is correct
5 Correct 163 ms 30804 KB Output is correct