# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305634 | ant101 | Mobile (BOI12_mobile) | C++14 | 912 ms | 51936 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 <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
#include <complex>
using namespace std;
#define rep(x,a) for(int x = 0; x < a; x++)
#define REP(x,a,b) for(int x = a; x < b; x++)
#define per(x,b) for(int x = b; x >= 0; x--)
#define all(container) (container).begin(), container.end()
#define rall(container) (container).rbegin(), container.rend()
#define sz(container) (int) (container).size()
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T> bool smin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool smax(T &a, T b) { return a < b ? (a = b, true) : false; }
#ifdef LOCAL_DEFINE
#include "DEBUG.hpp"
#else
#define debug(...) 0
#endif
const double eps = 1e-3;
const double EPS = 1e-9;
bool eq(double a, double b) {
return abs(a-b) <= eps;
}
int main(void)
{
int n;
double last;
scanf("%d%lf", &n, &last);
vector<pair<double, double>> points(n);
rep(i,n) scanf("%lf%lf", &points[i].fi, &points[i].sc);
vector<pair<double, double>> poi;
rep(i,n) {
poi.emplace_back(points[i]);
++i;
while (i < n && eq(points[i].fi, poi.back().fi)) ++i;
--i;
}
auto Can = [&](double dist) {
double r = 0.0;
rep(i,n) {
double delta = sqrt(dist*dist-points[i].sc*points[i].sc);
double L = points[i].fi-delta, R = points[i].fi+delta;
if (L <= r) smax(r, R);
}
return (r >= last);
};
double l = 0.0, r = 1e10;
while (r-l > eps) {
double mid = (r+l)/2.0;
if (Can(mid)) r = mid;
else l = mid;
}
printf("%.6lf\n", l);
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... |