답안 #1079722

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079722 2024-08-28T23:00:44 Z EmmaXII Mobile (BOI12_mobile) C++17
45 / 100
1000 ms 65168 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

#define all(x) x.begin(), x.end()


int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);

	int N;
	ll L;
	cin >> N >> L;

	vector<ll> X(N);
	vector<ll> Y(N);
	for (int i=0;i<N;i++) cin >> X[i] >> Y[i];

	auto get_hw = [&](double y, double r) {
		if (abs(y) > r) return -1.0;
		return sqrt((r-y) * (r+y));
	};

	auto can_do = [&](double R) {
		vector<pair<double, double>> ivals;
		for (int i=0;i<N;i++) {
			double hw = get_hw((double)Y[i], R);
			if (hw < 0) continue;
			ivals.push_back({(double)X[i] - hw, (double)X[i] + hw});
		}
		sort(all(ivals));
		double progress = 0.;
		for (auto [l, r] : ivals) {
			if (l > progress + 1e-5) return false;
			progress = max(progress, r);
			if (progress >= (double)L) return true;
		}

		return false;
	};

	double lo = 0;
	ll lhi = L + abs(X[0]) + abs(Y[0]);
	lhi = lhi*lhi;
	for (int i=0;i<N;i++) {
		ll nhi = max(
			X[i]*X[i] + Y[i]*Y[i],
			(X[i]-L)*(X[i]-L) + Y[i]*Y[i]
		);
		lhi = min(nhi, lhi);
	}
	double hi = sqrt(lhi);

	while (hi - lo > 5e-4) {
		double mid = (lo + hi) / 2;
		if (can_do(mid)) hi = mid;
		else lo = mid;
	}
	cout << setprecision(10);
	cout << lo << endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 576 KB Output is correct
2 Correct 5 ms 820 KB Output is correct
3 Correct 5 ms 692 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 6 ms 812 KB Output is correct
3 Correct 6 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 812 KB Output is correct
2 Correct 5 ms 812 KB Output is correct
3 Correct 7 ms 604 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 5656 KB Output is correct
2 Correct 168 ms 6016 KB Output is correct
3 Correct 97 ms 3584 KB Output is correct
4 Correct 16 ms 3464 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 3040 KB Output is correct
2 Correct 13 ms 2968 KB Output is correct
3 Correct 16 ms 3296 KB Output is correct
4 Correct 18 ms 3552 KB Output is correct
5 Correct 20 ms 3860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 89 ms 5988 KB Output is correct
2 Correct 185 ms 6280 KB Output is correct
3 Correct 211 ms 4768 KB Output is correct
4 Correct 24 ms 4572 KB Output is correct
5 Correct 15 ms 3296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 188 ms 7232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 134 ms 7220 KB Output is correct
2 Correct 242 ms 7076 KB Output is correct
3 Correct 241 ms 6276 KB Output is correct
4 Correct 28 ms 4576 KB Output is correct
5 Correct 20 ms 3824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 603 ms 28716 KB Output is correct
2 Execution timed out 1056 ms 32124 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1051 ms 32956 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 743 ms 43732 KB Output is correct
2 Execution timed out 1038 ms 45544 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1025 ms 45944 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 897 ms 46404 KB Output is correct
2 Execution timed out 1031 ms 53044 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1057 ms 50904 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1014 ms 50592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 55692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1043 ms 56872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1026 ms 65168 KB Time limit exceeded
2 Halted 0 ms 0 KB -