# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
633259 | afatpotato | Mobile (BOI12_mobile) | C++14 | 1096 ms | 56804 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
bool solve(double x);
vector<pair<double, double> > tower;
long long n, l;
int main() {
cin >> n >> l;
tower.resize(n);
for (int i = 0; i < n; i++) {
cin >> tower[i].first >> tower[i].second;
}
double low = 0;
double high = 4e9;
double ans = 0;
while (high - low > 1e-4) {
double mid = (low + high) / 2;
if (solve(mid)) {
ans = mid;
high = mid;
} else {
low = mid;
}
}
cout << fixed;
cout << setprecision(9);
cout << ans << endl;
}
bool solve(double x) {
vector<pair<double, double> > v;
for (int i = 0; i < n; i++) {
if (tower[i].second > x) {
continue;
}
double d = sqrt(x * x - tower[i].second * tower[i].second);
if (tower[i].first + d < 0) {
continue;
}
v.push_back(make_pair(max(tower[i].first - d, (double) 0), max(tower[i].first + d, (double) 0)));
}
sort(v.begin(), v.end());
if (v[0].first > 0) {
return false;
}
double r = v[0].second;
for (int i = 1; i < v.size(); i++) {
if (r < v[i].first) {
return false;
} else {
r = max(r, v[i].second);
}
}
if (r < l) {
return false;
}
return true;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |