Submission #349541

# Submission time Handle Problem Language Result Execution time Memory
349541 2021-01-17T19:10:02 Z Farrius Mobile (BOI12_mobile) C++11
25 / 100
1000 ms 3564 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

const int MX = 1e5 + 5;

int n;
ld l;
pair<ld, ld> ar[MX];

bool check (ld mid) {
	ld fins = 0;
	for (int i = 0; i < n; i++) {
		ld x, y;
		tie(x, y) = ar[i];
		ld delta = sqrt(mid * mid - y * y);
		if (x - delta <= fins) fins = max(fins, x + delta);
	}
	if (fins >= l) return true;
	else return false;
}

int main () {
	cin >> n >> l;
	for (int i = 0; i < n; i++) {
		cin >> ar[i].first >> ar[i].second;
	}
	ld sol = 1.5e9;
	ld hi = sol, lo = 0;
	for (int i = 0; i < 1000; i++) {
		ld mid = (lo + hi)/2;
		if (check(mid)) {
			sol = min(sol, mid);
			hi = mid;
		} else {
			lo = mid;
		}
	}
	cout << fixed << setprecision(3) << sol << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 364 KB Output is correct
2 Correct 5 ms 364 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 364 KB Output is correct
2 Correct 36 ms 364 KB Output is correct
3 Correct 65 ms 384 KB Output is correct
4 Correct 28 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 169 ms 620 KB Output is correct
2 Correct 61 ms 492 KB Output is correct
3 Correct 83 ms 492 KB Output is correct
4 Correct 167 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 168 ms 620 KB Output is correct
2 Correct 60 ms 492 KB Output is correct
3 Correct 82 ms 492 KB Output is correct
4 Correct 171 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 492 KB Output is correct
2 Correct 59 ms 620 KB Output is correct
3 Correct 86 ms 492 KB Output is correct
4 Correct 174 ms 620 KB Output is correct
5 Correct 162 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 2668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 2796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1020 ms 3184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 3564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 3436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 90 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 3564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 131 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 85 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 3460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 127 ms 3564 KB Output isn't correct
2 Halted 0 ms 0 KB -