# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
605457 | bzhu524 | Mobile (BOI12_mobile) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
pair<ll, ll> p[1000000];
int main() {
ios_base::sync_with_stdio(false);
int n, len;
cin >> n >> len;
for (int i=0; i<n; i++) cin >> p[i].first >> p[i].second;
double lower = 1;
double upper = 1000000000;
while (upper - lower >= 1e-3) {
double mid = (upper + lower) / 2;
double currPoint = 0;
for (int i=0; i<n; i++) {
ll x = p[i].first;
ll y = p[i].second;
double delta = sqrt(mid * mid - y * y);
double p1 = x - delta;
double p2 = x + delta;
if (p1 <= currPoint) {
currPoint = Math.max(currPoint, p2);
}
}
if (currPoint < len) {
lower = mid;
} else {
upper = mid;
}
}
cout << setprecision(4) << lower << "\n";
}