Submission #864761

#TimeUsernameProblemLanguageResultExecution timeMemory
864761nhatvpmMobile (BOI12_mobile)C++17
100 / 100
565 ms35048 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld=long double; void setIO(string name) { freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } void solve(){ ll n,l; cin>>n>>l; vector<ll> x(n),y(n); for (int i=0;i<n;i++) cin>>x[i]>>y[i]; ld lo=0,hi=3e9,eps=1e-9; while (hi-lo>eps){ ld mid=(lo+hi)/2,s=0; for (int i=0;i<n;i++){ if (mid<abs(y[i])) continue; ld d=sqrt(pow(mid,2)-pow(y[i],2)); ld a=x[i]-d,b=x[i]+d; if (a<=s) s=max(s,b); } if (s>=l) hi=mid; else lo=mid; } cout<<fixed<<setprecision(15)<<lo; } int main(){ //setIO(""); ios_base::sync_with_stdio(0); cin.tie(0); int tc=1; //cin>>tc; while (tc--){ solve(); } }

Compilation message (stderr)

mobile.cpp: In function 'void setIO(std::string)':
mobile.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  freopen((name+".out").c_str(),"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...