Submission #1063742

#TimeUsernameProblemLanguageResultExecution timeMemory
1063742davieduMobile (BOI12_mobile)C++17
0 / 100
1086 ms97576 KiB
#include <bits/stdc++.h> using namespace std; #define fastio ios_base::sync_with_stdio(0); cin.tie(0) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define ll long long #define ld long double struct P{ ll x, y; }; void dbg_out() { cerr << endl; } template <typename H, typename... T> void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); } #define dbg(...) { cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); } const ld prec = 0.00005; const ld MX = 1e10; vector<pair<ld, ld>> points; int n, len; bool f(ld r){ vector<pair<ld, int>> sections; for (auto& [x, y]: points){ if (r < y) continue; ld dx = sqrtl(r*r - y*y); sections.push_back({x-dx,-1}); sections.push_back({x+dx, 1}); } sort(all(sections)); bool can=true; ld right=-1; int cur=0; for (auto& [x, v]: sections){ if (right < x && x >= 0 && x < len && !cur){ can = false; break; } right = x; cur -= v; if (x > len) break; } return can && right >= len; } signed main(){ fastio; cin >> n >> len; points.resize(n); for (int i=0; i<n; i++){ cin >> points[i].first; cin >> points[i].second; } ld l=0, r=MX, ans=MX; while (r-l >= prec){ ld m = (l+r)/2; if (f(m)) r = m, ans = m; else l = m; } cout << fixed << setprecision(13); cout << ans << '\n'; }
#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...