Submission #349554

# Submission time Handle Problem Language Result Execution time Memory
349554 2021-01-17T19:28:31 Z Farrius Mobile (BOI12_mobile) C++11
90 / 100
1000 ms 35444 KB
#include <bits/stdc++.h>

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

const int MX = 1e6 + 5;

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

bool check (ld mid) {
	ld fins = 0;
	for (int i = 0; i < n; i++) {
		ll 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 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 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 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 3 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 5 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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 5 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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 6 ms 364 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 1644 KB Output is correct
2 Correct 67 ms 1644 KB Output is correct
3 Correct 43 ms 1132 KB Output is correct
4 Correct 75 ms 1516 KB Output is correct
5 Correct 36 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 1516 KB Output is correct
2 Correct 62 ms 1388 KB Output is correct
3 Correct 74 ms 1644 KB Output is correct
4 Correct 78 ms 1516 KB Output is correct
5 Correct 91 ms 1644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 1644 KB Output is correct
2 Correct 71 ms 1580 KB Output is correct
3 Correct 74 ms 1644 KB Output is correct
4 Correct 112 ms 1900 KB Output is correct
5 Correct 74 ms 1772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 1900 KB Output is correct
2 Correct 89 ms 1900 KB Output is correct
3 Correct 77 ms 1900 KB Output is correct
4 Correct 114 ms 1900 KB Output is correct
5 Correct 89 ms 1900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 1948 KB Output is correct
2 Correct 86 ms 1900 KB Output is correct
3 Correct 76 ms 1900 KB Output is correct
4 Correct 113 ms 1900 KB Output is correct
5 Correct 90 ms 1964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 355 ms 8172 KB Output is correct
2 Correct 454 ms 8300 KB Output is correct
3 Correct 437 ms 8300 KB Output is correct
4 Correct 561 ms 8280 KB Output is correct
5 Correct 469 ms 8172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 462 ms 8300 KB Output is correct
2 Correct 495 ms 8300 KB Output is correct
3 Correct 396 ms 8172 KB Output is correct
4 Correct 550 ms 8172 KB Output is correct
5 Correct 483 ms 8172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 424 ms 9708 KB Output is correct
2 Correct 548 ms 9836 KB Output is correct
3 Correct 525 ms 9836 KB Output is correct
4 Correct 701 ms 9708 KB Output is correct
5 Correct 565 ms 17772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 571 ms 9708 KB Output is correct
2 Correct 590 ms 9688 KB Output is correct
3 Correct 477 ms 9684 KB Output is correct
4 Correct 685 ms 9708 KB Output is correct
5 Correct 584 ms 18576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 494 ms 11372 KB Output is correct
2 Correct 640 ms 11244 KB Output is correct
3 Correct 619 ms 11372 KB Output is correct
4 Correct 796 ms 11372 KB Output is correct
5 Correct 641 ms 20588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 657 ms 11500 KB Output is correct
2 Correct 677 ms 11372 KB Output is correct
3 Correct 596 ms 11244 KB Output is correct
4 Correct 789 ms 11524 KB Output is correct
5 Correct 690 ms 21612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 572 ms 13080 KB Output is correct
2 Correct 726 ms 12908 KB Output is correct
3 Correct 695 ms 12908 KB Output is correct
4 Correct 904 ms 12908 KB Output is correct
5 Correct 761 ms 24044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 749 ms 12908 KB Output is correct
2 Correct 779 ms 12908 KB Output is correct
3 Correct 660 ms 22508 KB Output is correct
4 Correct 913 ms 28524 KB Output is correct
5 Correct 783 ms 24556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 713 ms 16016 KB Output is correct
2 Correct 912 ms 16236 KB Output is correct
3 Correct 878 ms 16248 KB Output is correct
4 Execution timed out 1093 ms 15940 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 933 ms 16084 KB Output is correct
2 Correct 969 ms 29292 KB Output is correct
3 Correct 827 ms 28400 KB Output is correct
4 Execution timed out 1089 ms 35444 KB Time limit exceeded
5 Halted 0 ms 0 KB -