Submission #1093063

#TimeUsernameProblemLanguageResultExecution timeMemory
1093063TommasoUlianMobile (BOI12_mobile)C++14
100 / 100
449 ms25936 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<pair<double, double>> torri; ll n, L; bool good(double r) { queue<pair<double, double>> s; double curr = 0; for (auto a : torri) { double x = a.first, y = a.second; if(curr >= L)return true; if (abs(y) <= r - 1e-6) { double dx = sqrt((r + y) * (r - y)); double a = x-dx, b = x+dx; if(a-1e-6 <= curr){ curr = max(b,curr); } } } return curr >= L; } void solve() { cin >> n >> L; torri.resize(n); for (int i = 0; i < n; i++) { cin >> torri[i].first >> torri[i].second; } double l = 1, r = 2e9; double ans = r; while (r - l > 1e-4) { double c = (r + l) / 2; if (good(c)) { ans = c; r = c; } else { l = c; } } cout << setprecision(18) << (l + r) / 2 << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }

Compilation message (stderr)

mobile.cpp: In function 'void solve()':
mobile.cpp:35:12: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   35 |     double ans = r;
      |            ^~~
#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...