# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305265 | oleksg | Mobile (BOI12_mobile) | C++14 | 1091 ms | 39152 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;
double n, l;
vector<pair<double, double>> 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);
if (cur >= cury){
double xintervals = sqrt(cur * cur - cury * cury);
double minx = curx - xintervals;
double maxx = curx + xintervals;
if (minx <= l && maxx >= 0 && cur >= cury){
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(){
double 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.0;
double ma = 10000000000;
//cout << ok(658);
while(ma - mi > 0.0005){
double cur = (mi + ma) / 2.0;
if (ok(cur)){
ma = cur;
}
else{
mi = cur + 0.0005;
}
}
printf("%.7g", 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... |