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 <iostream>
#include <math.h>
#define MAX_N 1000000
double x[MAX_N], y[MAX_N];
#define MAX(a,b) ((a > b) ? a : b)
using namespace std;
int main() {
int N;
cin >> N;
double L;
cin >> L;
for (int i = 0; i < N; i++) {
cin >> x[i] >> y[i];
y[i] = y[i] * y[i];
}
double l = 0., m, r = 2e9, m_sqr, c, t0, tn;
while(r - l > 0.00001) {
m = l / 2 + r / 2;
m_sqr = m * m;
c = 0.;
for (int j = 0; j < N; j++) {
if (m_sqr < y[j]) continue;
t0 = sqrt(m_sqr - y[j]);
tn = x[j] - t0;
if (tn > c) continue;
t0 += x[j];
c = MAX(t0, c);
}
//cout << c << ' ' << l << ' ' << r << ' ' << min_t << '\n';
if (c > L) r = m;
else l = m;
}
cout << l / 2 + r / 2 << '\n';
return 0;
}
# | 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... |