Submission #1075324

#TimeUsernameProblemLanguageResultExecution timeMemory
1075324vjudge1Mobile (BOI12_mobile)C++17
0 / 100
1088 ms53464 KiB
#include <bits/stdc++.h> using namespace std; #define dbg(x) cerr << #x << " = " << x << endl #define raya cerr << string(20, '=') << endl #define pv(x) cerr << #x << "[] : "; for (auto e:x) cerr << e << " "; cerr << endl #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define eb emplace_back #define ff first #define ss second typedef long long ll; int main() { ios_base::sync_with_stdio(NULL); cin.tie(nullptr); int n,L; cin >> n >> L; vector<int> x(n), y(n); for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; auto p = [&](double R) -> bool { vector<pair<double,double>> I; for (int i = 0; i < n; i++) { if (abs(y[i]) > R) continue; double d = sqrt(R * R - 1ll * y[i] * y[i]); double xL = x[i] - d; double xR = x[i] + d; if (xR < 0) continue; else if (xL < 0) xL = 0; else { if (xL <= L) { if (xR > L) xR = L; } else { continue; } } I.emplace_back(xL, xR); } sort(all(I)); if (I.empty()) return 0; if (I.front().ff > 0 or I.back().ss < L) return 0; for (int i = 0; i < sz(I) - 1; i++) { if (I[i].ss < I[i + 1].ff) return 0; } return 1; }; double lo = 0, hi = 3e9; for (int i = 0; i < 300; i++) { double mid = (lo + hi) / 2; if (p(mid)) hi = mid; else lo = mid; } cout << fixed << setprecision(10); cout << lo << '\n'; 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...