Submission #409995

# Submission time Handle Problem Language Result Execution time Memory
409995 2021-05-21T20:29:16 Z BERNARB01 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 65672 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long n, L;
	cin >> n >> L;
	vector<pair<long long, long long>> p(n);
	for (long long i = 0; i < n; i++) {
		cin >> p[i].first >> p[i].second;
	}
	long double l = -1, r = 2e9 + 1;
	for (long long itr = 0; itr < 100; itr++) {
		long double mid = (l + r) / 2.0;
		vector<pair<long double, long double>> v;
		long long ok = 1;
		for (long long i = 0; i < n; i++) {
			long double b = -2.0 * p[i].first;
			long double c = (p[i].first * p[i].first) + (p[i].second * p[i].second) - (mid * mid);
			long double delta = (b * b) - 4.0 * c;
			if (delta < 0) {
				continue;
			}
			long double lb = (-b - sqrtl(delta)) / 2.0, rb = (-b + sqrtl(delta)) / 2.0;
			if (lb > (long double) L) {
				continue;
			}
			while (!v.empty() && lb < v.back().first) {
				v.pop_back();
			}
			if (!v.empty() && v.back().second < lb) {
				ok = 0;
				break;
			}
			v.push_back({lb, rb});
		}
		if (v.empty() || !ok || (!v.empty() && ((min((long double) L, end(v)[-1].second) - max(v[0].first, (long double) 0.0)) < (long double) L))) {
			l = mid;
		} else {
			r = mid;
		}
	}
	cout << setprecision(4) << fixed << (r + l) / 2.0 << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 844 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 196 ms 8372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 117 ms 5284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 565 ms 9020 KB Output is correct
2 Correct 295 ms 8944 KB Output is correct
3 Correct 258 ms 9404 KB Output is correct
4 Incorrect 102 ms 4160 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 458 ms 5580 KB Output is correct
2 Correct 353 ms 9496 KB Output is correct
3 Correct 315 ms 10196 KB Output is correct
4 Incorrect 103 ms 4240 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 538 ms 9524 KB Output is correct
2 Correct 351 ms 9464 KB Output is correct
3 Correct 313 ms 10232 KB Output is correct
4 Incorrect 98 ms 4212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 40904 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 10692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 59592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 12256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 61000 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 13824 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 62520 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 15380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 65672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 18240 KB Time limit exceeded
2 Halted 0 ms 0 KB -