Submission #735101

#TimeUsernameProblemLanguageResultExecution timeMemory
735101ace_in_the_holeMobile (BOI12_mobile)C++17
90 / 100
1037 ms27432 KiB
#include<bits/stdc++.h> using namespace std; typedef long long Int; typedef long double Real; const Real EPS = 1e-6; bool leq(Real x, Real y) { return x-EPS <= y; } const int N = 1e6 + 50; int n,L, x[N], y[N]; bool check(Real dis) { Real rightmost = 0; for (int i = 1; i <= n; i++) { if (leq(dis, y[i])) continue; Real lef = x[i] - sqrt(dis*dis - 1ll*y[i]*y[i]); Real rig = 2*x[i] - lef; if (leq(lef, rightmost)) rightmost = max(rightmost, rig); } return leq(L,rightmost); } void solve() { cin >> n >> L; for (int i = 1; i <= n; i++) cin >> x[i] >> y[i]; const Real DEL = 1e-3; Real ans = 0; for (Real low = 0, high = 1e9 * sqrt(5); high - low >= DEL; ) { Real mid = (low + high) / 2; if (check(mid)) high = mid; else ans = low = mid; } cout << fixed << setprecision(15) << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "WF" if (fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } solve(); }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:45:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |   freopen(task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:46:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...