# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
964109 | dubabuba | Mobile (BOI12_mobile) | C++14 | 562 ms | 6972 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define MP make_pair
const int mxn = 1e5 + 10;
int x[mxn], y[mxn], n, m;
bool can(double R) {
vector<pair<double, double>> buba;
for(int i = 0; i < n; i++) {
const double &X = x[i];
const double &Y = y[i];
if(R < Y) continue;
if(R == Y) {
if(0.0 <= X && X <= (double) m)
buba.push_back(MP(X, X));
continue;
}
double d = sqrt(R * R - Y * Y);
double l = X - d, r = X + d;
if(r < 0.0 || (double) m < l) continue;
l = max(l, 0.0);
r = min(r, (double) m);
buba.push_back(MP(l, r));
}
sort(buba.begin(), buba.end());
// cout << R << endl;
// for(auto p : buba)
// cout << p.ff << ' ' << p.ss << endl;
if(buba[0].ff > 0.0) return 0;
if(buba.back().ss < (double) m) return 0;
for(int i = 1; i < buba.size(); i++)
if(buba[i - 1].ss < buba[i].ff)
return 0;
return 1;
}
int main() {
cin >> n >> m;
for(int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
y[i] = abs(y[i]);
}
double L = 0.0;
double R = 1e18;
cout << setprecision(5) << fixed;
while(R - L > 1e-5) {
double M = L + (R - L) / 2;
if(can(M)) R = M;
else L = M;
}
cout << R << endl;
return 0;
}
Compilation message (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... |