Submission #1026868

#TimeUsernameProblemLanguageResultExecution timeMemory
1026868PooyaDaftarianMobile (BOI12_mobile)C++17
100 / 100
611 ms35412 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef double ld; #define all(x) x.begin(), x.end() #define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL) #define file(x) freopen(x ".in", "r", stdin); freopen(x ".out", "w", stdout) #define endl '\n' #define pb push_back #define ms(x, y) memset(x, y, sizeof x) #define out(x) {cout << x << '\n'; return;} #define ff first #define ss second #define sz(x) (int)(x).size() #define int ll int n, L; vector<pair<ld, ld>> a; bool chk(ld x){ ld mx = 0; for (int i = 0 ; i < n ; i++){ ld d = sqrt(x*x - a[i].ss*a[i].ss); ld x = a[i].ff - d, y = a[i].ff + d; if (x <= mx) mx = max(mx, y); } return (mx < L); } int32_t main(){ fast_io; cout << fixed << setprecision(6); cin >> n >> L; a.assign(n, {0.0, 0.0}); for (int i = 0 ; i < n ; i++){ ld x, h; cin >> x >> h; a[i] = {x, h}; } ld l = 0, r = 1e10, mid; for (int i = 0 ; i < 60 ; i++){ mid = l + (r-l)/2; if (chk(mid)) l = mid; else r = mid; } cout << l << endl; 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...