답안 #670685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670685 2022-12-09T20:48:46 Z thiago_bastos Mobile (BOI12_mobile) C++17
17 / 100
1000 ms 24556 KB
#include "bits/stdc++.h"

using namespace std;

#define INF 1000000000
#define INFLL 1000000000000000000ll
#define EPS 1e-9
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define fi first
#define sc second

using i64 = long long;
using u64 = unsigned long long;
using ld = long double;
using ii = pair<int, int>;

const int N = 1e6 + 10;
int n, l;
ii pt[N];

bool evaluate(double d) {
	double last = 0;
	for(int i = 0; i < n; ++i) {
		auto [x, y] = pt[i];
		if(abs(y) > d) continue;
		double z = sqrt(d * d - (i64)y * y);
		if(max(0.0, x - z) <= last) last = max(last, min(l + 0.0, x + z));
	}
	return last >= l;
}

void solve() {
	cin >> n >> l;
	for(int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		pt[i] = {x, y};
	}
	sort(pt, pt + n);
	double lo = 0, hi = 2 * INF;	
	while(fabs(lo - hi) > EPS) {
		double m = (lo + hi) / 2;
		if(evaluate(m)) hi = m;
		else lo = m;
	}
	cout << fixed << setprecision(9) << hi << '\n';
}

int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t--) solve();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 328 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 356 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Execution timed out 1095 ms 340 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Execution timed out 1078 ms 340 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 340 KB Output is correct
2 Execution timed out 1085 ms 340 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 1688 KB Output is correct
2 Execution timed out 1077 ms 2004 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1576 KB Output is correct
2 Correct 23 ms 1668 KB Output is correct
3 Correct 26 ms 1896 KB Output is correct
4 Correct 26 ms 2124 KB Output is correct
5 Correct 36 ms 2340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 1580 KB Output is correct
2 Execution timed out 1083 ms 2028 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 2544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 2508 KB Output is correct
2 Execution timed out 1092 ms 2460 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1067 ms 8396 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1058 ms 12364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 10060 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1052 ms 14756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 11748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1047 ms 17228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1074 ms 13388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1045 ms 19668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1069 ms 16876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1016 ms 24556 KB Time limit exceeded
2 Halted 0 ms 0 KB -