Submission #349539

# Submission time Handle Problem Language Result Execution time Memory
349539 2021-01-17T19:07:56 Z Farrius Mobile (BOI12_mobile) C++11
50 / 100
459 ms 5552 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 = 1e9 + 7;
	ld hi = sol, lo = 0;
	for (int i = 0; i < 100; 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 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 10 ms 492 KB Output is correct
2 Correct 6 ms 492 KB Output is correct
3 Correct 8 ms 364 KB Output is correct
4 Correct 6 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 492 KB Output is correct
2 Correct 11 ms 492 KB Output is correct
3 Correct 12 ms 492 KB Output is correct
4 Correct 21 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 492 KB Output is correct
2 Correct 11 ms 492 KB Output is correct
3 Correct 12 ms 492 KB Output is correct
4 Correct 21 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 492 KB Output is correct
2 Correct 11 ms 492 KB Output is correct
3 Correct 12 ms 492 KB Output is correct
4 Correct 22 ms 620 KB Output is correct
5 Correct 19 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 267 ms 3436 KB Output is correct
2 Correct 164 ms 3972 KB Output is correct
3 Correct 133 ms 2668 KB Output is correct
4 Correct 326 ms 3820 KB Output is correct
5 Correct 185 ms 2412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 300 ms 3564 KB Output is correct
2 Correct 279 ms 3308 KB Output is correct
3 Correct 336 ms 3948 KB Output is correct
4 Correct 336 ms 4204 KB Output is correct
5 Correct 385 ms 4588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 169 ms 3952 KB Output is correct
2 Correct 175 ms 4076 KB Output is correct
3 Correct 210 ms 3948 KB Output is correct
4 Correct 459 ms 5432 KB Output is correct
5 Correct 346 ms 4224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 216 ms 4972 KB Output is correct
2 Correct 210 ms 4844 KB Output is correct
3 Correct 243 ms 4588 KB Output is correct
4 Correct 457 ms 5484 KB Output is correct
5 Correct 407 ms 4824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 4972 KB Output is correct
2 Correct 215 ms 5228 KB Output is correct
3 Correct 244 ms 4460 KB Output is correct
4 Correct 459 ms 5484 KB Output is correct
5 Correct 408 ms 4716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 86 ms 4460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 5228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 4460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 5228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 4588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 128 ms 5356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 85 ms 4460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 5320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 4716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 5552 KB Output isn't correct
2 Halted 0 ms 0 KB -