Submission #88198

# Submission time Handle Problem Language Result Execution time Memory
88198 2018-12-04T10:30:01 Z JustInCase Mobile (BOI12_mobile) C++17
100 / 100
480 ms 62208 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) {
	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 = 1e14;
	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 3 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 540 KB Output is correct
2 Correct 3 ms 568 KB Output is correct
3 Correct 2 ms 592 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 656 KB Output is correct
3 Correct 3 ms 680 KB Output is correct
4 Correct 3 ms 692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 732 KB Output is correct
2 Correct 5 ms 772 KB Output is correct
3 Correct 4 ms 840 KB Output is correct
4 Correct 5 ms 880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 952 KB Output is correct
2 Correct 4 ms 1020 KB Output is correct
3 Correct 4 ms 1092 KB Output is correct
4 Correct 4 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1116 KB Output is correct
2 Correct 4 ms 1296 KB Output is correct
3 Correct 4 ms 1296 KB Output is correct
4 Correct 4 ms 1296 KB Output is correct
5 Correct 4 ms 1296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 2284 KB Output is correct
2 Correct 34 ms 3332 KB Output is correct
3 Correct 21 ms 3332 KB Output is correct
4 Correct 30 ms 3332 KB Output is correct
5 Correct 18 ms 3332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 3664 KB Output is correct
2 Correct 27 ms 4036 KB Output is correct
3 Correct 32 ms 4216 KB Output is correct
4 Correct 33 ms 4216 KB Output is correct
5 Correct 35 ms 4216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 4292 KB Output is correct
2 Correct 38 ms 4344 KB Output is correct
3 Correct 33 ms 4344 KB Output is correct
4 Correct 40 ms 4348 KB Output is correct
5 Correct 34 ms 4348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 4348 KB Output is correct
2 Correct 41 ms 5752 KB Output is correct
3 Correct 38 ms 6904 KB Output is correct
4 Correct 41 ms 8700 KB Output is correct
5 Correct 38 ms 10016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 10016 KB Output is correct
2 Correct 44 ms 10016 KB Output is correct
3 Correct 39 ms 10248 KB Output is correct
4 Correct 41 ms 10248 KB Output is correct
5 Correct 39 ms 10756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 193 ms 14584 KB Output is correct
2 Correct 223 ms 16828 KB Output is correct
3 Correct 212 ms 16828 KB Output is correct
4 Correct 191 ms 16828 KB Output is correct
5 Correct 189 ms 16828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 225 ms 17176 KB Output is correct
2 Correct 265 ms 17176 KB Output is correct
3 Correct 186 ms 17176 KB Output is correct
4 Correct 198 ms 17176 KB Output is correct
5 Correct 190 ms 17176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 238 ms 17860 KB Output is correct
2 Correct 258 ms 21032 KB Output is correct
3 Correct 256 ms 21032 KB Output is correct
4 Correct 242 ms 23756 KB Output is correct
5 Correct 224 ms 23828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 258 ms 23828 KB Output is correct
2 Correct 309 ms 23980 KB Output is correct
3 Correct 223 ms 23980 KB Output is correct
4 Correct 230 ms 23980 KB Output is correct
5 Correct 225 ms 23980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 282 ms 24616 KB Output is correct
2 Correct 292 ms 24616 KB Output is correct
3 Correct 297 ms 24616 KB Output is correct
4 Correct 267 ms 24708 KB Output is correct
5 Correct 258 ms 24708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 306 ms 24708 KB Output is correct
2 Correct 333 ms 24708 KB Output is correct
3 Correct 265 ms 24708 KB Output is correct
4 Correct 263 ms 24708 KB Output is correct
5 Correct 254 ms 24708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 306 ms 26540 KB Output is correct
2 Correct 339 ms 26540 KB Output is correct
3 Correct 340 ms 26692 KB Output is correct
4 Correct 303 ms 26692 KB Output is correct
5 Correct 287 ms 26692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 348 ms 26692 KB Output is correct
2 Correct 384 ms 26692 KB Output is correct
3 Correct 296 ms 26692 KB Output is correct
4 Correct 302 ms 26692 KB Output is correct
5 Correct 287 ms 26692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 378 ms 27976 KB Output is correct
2 Correct 429 ms 27980 KB Output is correct
3 Correct 415 ms 28080 KB Output is correct
4 Correct 383 ms 28080 KB Output is correct
5 Correct 369 ms 28232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 441 ms 28232 KB Output is correct
2 Correct 480 ms 28232 KB Output is correct
3 Correct 397 ms 28232 KB Output is correct
4 Correct 394 ms 47304 KB Output is correct
5 Correct 372 ms 62208 KB Output is correct