Submission #424415

#TimeUsernameProblemLanguageResultExecution timeMemory
424415winstonyinMobile (BOI12_mobile)C++11
100 / 100
963 ms35476 KiB
#include <string> #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cmath> #include <array> #include <map> #include <set> #include <fstream> #include <unordered_map> #include <queue> #include <iomanip> using namespace std; using pi = pair<int, int>; using pd = pair<double, double>; #define ll long long #define all(x) (x).begin(), (x).end() int n_stations, l_highway; vector<pd> locations; bool works(double radius) { double curr = 0; for(int i = 0; i < n_stations; i++) { double delta = sqrt(radius*radius - locations[i].second*locations[i].second); double left = locations[i].first - delta, right = locations[i].first + delta; if(left <= curr) { curr = max(curr, right); } } return curr >= l_highway; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n_stations >> l_highway; for(int i = 0; i < n_stations; i++) { double x,y; cin >> x >> y; locations.push_back({x,y}); } double a = 0, b = 1.5e9; double ans; while(b - a > 1e-3) { double m = (a+b)/2.0; if(works(m)) { b = m; ans = m; } else { a = m; } } cout << fixed << setprecision(4) << ans; 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...