이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define prob "mobile"
#define x first
#define y second
using namespace std;
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int n,L;
pair<double,double> p[maxn+5];
int main(){
// freopen(prob".inp","r",stdin);
// freopen(prob".out","w",stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n >> L;
for(int i=1;i<=n;i++) cin >> p[i].x >> p[i].y;
auto check = [&](double val) -> int{
vector<pair<double,double>> G;
for(int i=1;i<=n;i++){
if(val < p[i].y) return 0;
double tmp = sqrt(val*val-p[i].y*p[i].y);
double xL = p[i].x - tmp;
double xR = p[i].x + tmp;
G.push_back(make_pair(xL,xR));
}
double xmaxx = G[0].y;
double xminn = G[0].x;
for(int i=1;i<n;i++){
if(G[i].x > xmaxx) return 0;
xminn = min(xminn,G[i].x);
xmaxx = max(xmaxx,G[i].y);
}
return 1;
};
double low = 0, high = 1e9, res = 0;
for(int i=1;i<=100;i++){
if(high - low < eps) break;
double mid = (low + high) / (double)(2);
if(check(mid)){
res = mid;
high = mid;
}
else{
low = mid;
}
}
cout << fixed << setprecision(6);
cout << res;
}
# | 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... |