Submission #1124540

#TimeUsernameProblemLanguageResultExecution timeMemory
1124540DON_FMobile (BOI12_mobile)C++20
0 / 100
679 ms41152 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define L(i, b, e) for (int i = b; i < e; ++i) #define R(i, b, e) for (int i = b; i >= e; --i) #define pb emplace_back #define vi vector<int> #define sz(x) ((int) x.size()) const int N = 1e6 + 7, Mx = 1e9 + 9; int n, l; int x[N], y[N]; using ld = long double; ld dis(pair<ld, int> p1, pair<int, int> p2){ return (ld) abs(p1.first - p2.first) * abs(p1.first - p2.first) + (ld) abs(p1.second - p2.second) * abs(p1.second - p2.second); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> l; L(i, 0, n){ cin >> x[i] >> y[i]; } vector<pair<ld, int>> st; st.pb(0, 0); const ld E = 1e-4; L(i, 1, n){ ld ed = l + 1; while (!st.empty()){ ld lo = 0, hi = l, res = -1; ld fs = st.back().first; int id = st.back().second; while (lo <= hi){ ld mid = lo + (hi - lo) / 2; if (dis({mid, 0}, {x[i], y[i]}) < dis({mid, 0}, {x[id], y[id]})){ res = mid; hi = mid - E; }else{ lo = mid + E; } } if (res != -1){ ed = res; if (res <= fs){ st.pop_back(); }else{ break; } }else{ break; } } if (ed != l + 1){ st.pb(ed, i); } } st.pb(l + E, l + 1); ld ans = 0; L(i, 0, sz(st) - 1){ ans = max(ans, dis({st[i].first, 0}, {x[st[i].second], y[st[i].second]})); ans = max(ans, dis({st[i + 1].first - E, 0}, {x[st[i].second], y[st[i].second]})); } long double f = sqrtl(ans); cout << fixed << setprecision(6) << f; }
#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...