Submission #349546

# Submission time Handle Problem Language Result Execution time Memory
349546 2021-01-17T19:20:16 Z Farrius Mobile (BOI12_mobile) C++11
50 / 100
275 ms 3692 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 hi = 1.5e9, lo = 1;
	while (hi - lo > 1e-3) {
		ld mid = (lo + hi)/2;
		if (check(mid)) {
			hi = mid;
		} else {
			lo = mid;
		}
	}
	cout << fixed << setprecision(4) << lo << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 492 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 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 5 ms 364 KB Output is correct
2 Correct 5 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 492 KB Output is correct
2 Correct 8 ms 492 KB Output is correct
3 Correct 7 ms 492 KB Output is correct
4 Correct 12 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 492 KB Output is correct
2 Correct 9 ms 492 KB Output is correct
3 Correct 7 ms 492 KB Output is correct
4 Correct 12 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 492 KB Output is correct
2 Correct 8 ms 492 KB Output is correct
3 Correct 8 ms 492 KB Output is correct
4 Correct 12 ms 492 KB Output is correct
5 Correct 9 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 135 ms 2668 KB Output is correct
2 Correct 117 ms 2668 KB Output is correct
3 Correct 85 ms 2048 KB Output is correct
4 Correct 195 ms 2924 KB Output is correct
5 Correct 87 ms 2048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 2796 KB Output is correct
2 Correct 141 ms 2668 KB Output is correct
3 Correct 172 ms 2924 KB Output is correct
4 Correct 185 ms 2796 KB Output is correct
5 Correct 213 ms 3052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 3060 KB Output is correct
2 Correct 124 ms 2956 KB Output is correct
3 Correct 131 ms 2924 KB Output is correct
4 Correct 275 ms 3564 KB Output is correct
5 Correct 170 ms 3104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 158 ms 3436 KB Output is correct
2 Correct 150 ms 3564 KB Output is correct
3 Correct 155 ms 3632 KB Output is correct
4 Correct 264 ms 3388 KB Output is correct
5 Correct 211 ms 3448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 174 ms 3564 KB Output is correct
2 Correct 151 ms 3436 KB Output is correct
3 Correct 153 ms 3532 KB Output is correct
4 Correct 265 ms 3564 KB Output is correct
5 Correct 209 ms 3436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 86 ms 3692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 3488 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 124 ms 3484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 3692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 3584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 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 122 ms 3436 KB Output isn't correct
2 Halted 0 ms 0 KB -