Submission #88197

# Submission time Handle Problem Language Result Execution time Memory
88197 2018-12-04T10:28:58 Z JustInCase Mobile (BOI12_mobile) C++17
95 / 100
861 ms 132096 KB
#include <bits/stdc++.h>

const int32_t MAX_N = 1e6;
const double EPS = 1e-6;

int32_t n, l;
std::pair< int32_t, int32_t > points[MAX_N + 5];

bool Check(double r) {
	std::vector< std::pair< double, bool > > events(2 * n);

	double curr = 0;
	for(int32_t i = 0; i < n; i++) {
		if(r * r < (int64_t) points[i].second * points[i].second) {
			continue;
		}

		double x1 = points[i].first - sqrt(r * r - (int64_t) points[i].second * points[i].second);
		double x2 = points[i].first + sqrt(r * r - (int64_t) points[i].second * points[i].second);

		if(!(x1 > curr)) {
			curr = std::max(curr, x2);
		}
	}

	if(!(curr < l)) {
		return true;
	}
	else {
		return false;
	}
}

int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);

	std::cin >> n >> l;

	for(int32_t i = 0; i < n; i++) {
		std::cin >> points[i].first >> points[i].second;
	}

	int64_t low = 1, high = 1e15;
	double ans;
	while(low <= high) {
		int64_t mid = (low + high) / 2;

		if(Check(mid / 10000.0)) {
			ans = mid / 10000.0;
			high = mid - 1;
		}
		else {
			low = mid + 1;
		}
	}

	std::cout << std::fixed << std::setprecision(7);
	std::cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
4 Correct 2 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 620 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
4 Correct 2 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 796 KB Output is correct
2 Correct 4 ms 796 KB Output is correct
3 Correct 3 ms 796 KB Output is correct
4 Correct 4 ms 820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 984 KB Output is correct
2 Correct 5 ms 1028 KB Output is correct
3 Correct 5 ms 1096 KB Output is correct
4 Correct 5 ms 1136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1208 KB Output is correct
2 Correct 5 ms 1248 KB Output is correct
3 Correct 5 ms 1444 KB Output is correct
4 Correct 5 ms 1444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1444 KB Output is correct
2 Correct 5 ms 1444 KB Output is correct
3 Correct 5 ms 1444 KB Output is correct
4 Correct 5 ms 1444 KB Output is correct
5 Correct 5 ms 1444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 4748 KB Output is correct
2 Correct 50 ms 5788 KB Output is correct
3 Correct 33 ms 5788 KB Output is correct
4 Correct 43 ms 5788 KB Output is correct
5 Correct 27 ms 5788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 5964 KB Output is correct
2 Correct 40 ms 5964 KB Output is correct
3 Correct 46 ms 6212 KB Output is correct
4 Correct 46 ms 6212 KB Output is correct
5 Correct 51 ms 6356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 6408 KB Output is correct
2 Correct 51 ms 6408 KB Output is correct
3 Correct 47 ms 6408 KB Output is correct
4 Correct 55 ms 6812 KB Output is correct
5 Correct 48 ms 6812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 6812 KB Output is correct
2 Correct 61 ms 8204 KB Output is correct
3 Correct 55 ms 9228 KB Output is correct
4 Correct 59 ms 11224 KB Output is correct
5 Correct 55 ms 11232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 11232 KB Output is correct
2 Correct 61 ms 11232 KB Output is correct
3 Correct 54 ms 11232 KB Output is correct
4 Correct 58 ms 11336 KB Output is correct
5 Correct 54 ms 11784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 361 ms 27844 KB Output is correct
2 Correct 389 ms 28840 KB Output is correct
3 Correct 365 ms 28840 KB Output is correct
4 Correct 374 ms 28860 KB Output is correct
5 Correct 344 ms 28860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 392 ms 28860 KB Output is correct
2 Correct 416 ms 28860 KB Output is correct
3 Correct 348 ms 28892 KB Output is correct
4 Correct 334 ms 28892 KB Output is correct
5 Correct 320 ms 28892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 465 ms 32776 KB Output is correct
2 Correct 508 ms 34044 KB Output is correct
3 Correct 506 ms 34044 KB Output is correct
4 Correct 453 ms 35720 KB Output is correct
5 Correct 434 ms 35736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 453 ms 35736 KB Output is correct
2 Correct 515 ms 35736 KB Output is correct
3 Correct 421 ms 35908 KB Output is correct
4 Correct 412 ms 35908 KB Output is correct
5 Correct 422 ms 35908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 529 ms 39692 KB Output is correct
2 Correct 546 ms 39692 KB Output is correct
3 Correct 534 ms 39692 KB Output is correct
4 Correct 538 ms 39692 KB Output is correct
5 Correct 545 ms 39692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 578 ms 39692 KB Output is correct
2 Correct 635 ms 39692 KB Output is correct
3 Correct 549 ms 39692 KB Output is correct
4 Correct 542 ms 39692 KB Output is correct
5 Correct 537 ms 39804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 596 ms 44252 KB Output is correct
2 Correct 647 ms 44308 KB Output is correct
3 Correct 632 ms 44308 KB Output is correct
4 Correct 612 ms 44340 KB Output is correct
5 Correct 585 ms 44404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 659 ms 44404 KB Output is correct
2 Correct 703 ms 44404 KB Output is correct
3 Correct 628 ms 44404 KB Output is correct
4 Correct 641 ms 44424 KB Output is correct
5 Correct 606 ms 44424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 794 ms 52160 KB Output is correct
2 Correct 828 ms 67808 KB Output is correct
3 Correct 832 ms 82292 KB Output is correct
4 Correct 787 ms 101592 KB Output is correct
5 Correct 710 ms 114996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 755 ms 115052 KB Output is correct
2 Correct 861 ms 128424 KB Output is correct
3 Runtime error 746 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
4 Halted 0 ms 0 KB -