Submission #798425

#TimeUsernameProblemLanguageResultExecution timeMemory
798425trMatherzMobile (BOI12_mobile)C++17
100 / 100
812 ms35388 KiB
# include <numeric> # include <vector> # include <algorithm> # include <cmath> # include <array> # include <bitset> # include <set> # include <map> # include <string> # include <cstdlib> # include <queue> # include <iomanip> using namespace std; #define ll long long int #define all(x) x.begin(), x.end() #define f x.first #define s x.second # include <iostream> /* # include <fstream> ifstream cin ("angry.in"); ofstream cout ("angry.out"); */ /* 1 3 8 10 11 2 5 2 1 */ int main(){ int n, k; cin >> n >> k; vector<array<ll, 2>> a(n); for(int i = 0; i < n; i++){ cin >> a[i][0] >> a[i][1]; } auto cf = [&](double m){ double cur = 0; for(int i = 0; i < n; i++){ double d = sqrt(m*m - a[i][1]*a[i][1]); double e1 = a[i][0] - d, e2 = a[i][0] + d; if(e1 <= cur){cur = max(cur, e2);} } if(cur >= k){return false;} return true; }; double l = 1, r = 1.5e9; while(r - l > 1e-5 ){ double m = (r+l)/2; if(cf(m)){l = m;} else{r = m;} } cout << fixed << setprecision(4) << l; 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...