Submission #1093459

#TimeUsernameProblemLanguageResultExecution timeMemory
1093459selmahbnMobile (BOI12_mobile)C++17
0 / 100
608 ms48208 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pdl pair<double, ll> double sp(double x1, double y1, double x2, double y2) { double top = x2*x2 - x1*x1 + y2*y2 - y1*y1; double bottom = 2*x2 - 2*x1; return top/bottom; } int main() { ll n; double l; cin >> n >> l; vector<pdl> p(n); ll li = -1; vector<double> x(n); vector<double> y(n); for (ll i = 0; i < n; i++) { cin >> x[i] >> y[i]; double last; bool gleich = false; while (li >= 0) { double lsp, i2; tie(lsp, i2) = p[li]; if (x[i] == x[i2]) { gleich = true; break; } double csp = sp(x[i], y[i], x[i2], y[i2]); if (csp <= lsp) { li--; } else { last = csp; break; } } if (gleich) continue; if (li == -1) p[0] = make_pair(0, i); else p[li+1] = make_pair(last, i); li++; } double maxi = 0; ll last = p[0].second; for (ll i = 0; i <= li; i++) { double csp, ci; tie(csp, ci) = p[i]; if (csp > l || i == li) { if (i == li) last = ci; double dist = sqrt((x[last]-l)*(x[last]-l)+y[last]*y[last]); maxi = max(maxi, dist); } double dist = sqrt((x[ci]-csp)*(x[ci]-csp)+y[ci]*y[ci]); maxi = max(maxi, dist); last = ci; } cout << maxi; 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...