Submission #1116507

# Submission time Handle Problem Language Result Execution time Memory
1116507 2024-11-21T18:22:08 Z vomanos Mobile (BOI12_mobile) C++14
0 / 100
674 ms 32328 KB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pdd pair<double, double>

double dist2(pdd a, pdd b) {
	return (a.first - b.first) * (a.first - b.first)
	+ (a.second - b.second) * (a.second - b.second);
}

int main() {
	int N;
	ll L;
	cin >> N >> L;

	pdd s[N];
	for (int i = 0; i < N; i++) cin >> s[i].first >> s[i].second;

	double low = 0, high = 1e12;
	// double low = 6, high = 6.01;
	while (high - low > 0.000001) {
		double mid = low + (high - low) / 2;

		double x = 0;
		for (int i = 0; i < N; i++) {
			if (dist2({x, 0}, {s[i]}) > mid*mid) continue;

			// let x = s[i].first, y = s[i].second;
			// (x + d)^2 + y^2 = r^2
			// x + d = sqrt(r^2 - y^2)
			//d = sqrt(r^2 - y^2)

			x = s[i].first + sqrt(mid*mid - s[i].second * s[i].second);
		}

		// cout << mid << " " << x << endl;

		if (x >= L) high = mid - 1;
		else low = mid + 1;
	}

	cout << fixed << setprecision(10) << low;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 2344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 3400 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 3408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 284 ms 12328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 419 ms 16296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 338 ms 14792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 412 ms 19696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 393 ms 17428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 497 ms 22856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 443 ms 19784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 621 ms 26108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 586 ms 24640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 674 ms 32328 KB Output isn't correct
2 Halted 0 ms 0 KB -