Submission #973225

#TimeUsernameProblemLanguageResultExecution timeMemory
973225HuyATMobile (BOI12_mobile)C++14
100 / 100
992 ms31980 KiB
#include<bits/stdc++.h> const int MaxN = 1e6 + 10; const long double Eps = 1e-4; const long double MaxV = 1e9; int n; long double length,x[MaxN + 1],y[MaxN + 1]; void readData(){ std::cin >> n >> length; for(int i = 1;i <= n;++i){ std::cin >> x[i] >> y[i]; } } bool f(long double mid){ long double l = 0,r = 0; for(int i = 1;i <= n;++i){ if(mid < y[i]){ continue; } long double distance = sqrt(mid * mid - y[i] * y[i]); if(x[i] - distance <= r && x[i] + distance >= l){ l = std::min(l,x[i] - distance); r = std::max(r,x[i] + distance); } } return (l <= 0 && r >= length); } long double solve(long double lo,long double hi){ while(hi - lo > Eps){ long double mid = (lo + hi) / 2; if(f(mid)){ hi = mid; }else{ lo = mid; } // std::cerr << mid << "\n"; } return hi; } int main(){ std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr);std::cout.tie(nullptr); readData(); std::cout << std::fixed << std::setprecision(8) << solve(0,MaxV * 2); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...