# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305253 | oleksg | Mobile (BOI12_mobile) | C++14 | 1099 ms | 48116 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 <fstream>
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include<bits/stdc++.h>
#include <vector>
using namespace std;
long long n, l;
vector<pair<long long, long long>> points;
bool ok(double cur){
vector<pair<double, double>> segs;
for (long long x = 0; x < points.size(); x++){
double curx = points[x].first;
double cury = abs(points[x].second);
double xintervals = sqrt(pow(cur, 2) - pow(cury, 2));
double minx = max((double)0, curx - xintervals);
double maxx = min((double)l, curx + xintervals);
if (minx <= l && maxx >= 0){
segs.push_back(make_pair(minx, maxx));
}
}
sort(segs.begin(), segs.end());
if (segs[0].first > 0){
return false;
}
double curx = 0;
for (long long x = 0; x < segs.size(); x++){
if (segs[x].second > curx){
if (segs[x].first <= curx){
curx = segs[x].second;
}
else{
return false;
}
}
}
if (curx < l){
return false;
}
return true;
}
int main(){
long long one, two;
cin >> n >> l;
for (int x = 0; x < n; x++){
cin >> one >> two;
points.push_back(make_pair(one, two));
}
double mi = 0;
double ma = 10000000000;
while(ma - mi > 0.0001){
double cur = (mi + ma) / 2.0;
if (ok(cur)){
ma = cur;
}
else{
mi = cur + 0.0001;
}
}
cout << setprecision(20) << ma;
}
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... |