Submission #943347

#TimeUsernameProblemLanguageResultExecution timeMemory
943347abel2008Mobile (BOI12_mobile)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <iomanip> #define ll long long using namespace std; ll n,len; pair<ll,ll> a[1000005]; //ll lungimi[1000006]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin>>n>>len; for (int i = 1;i<=n;++i) { cin>>a[i].first>>a[i].second; } double l = 1,r = 1.5e9; while(r-l>1e-3) { double mid = (l+r)/2,curr = 0; for (int i = 1;i<=n;++i) { // aflam prt dr si st double st,dr,dif; dif = sqrt((mid*mid)-(a[i].second*a[i].second)); st = a[i].first-dif,dr = a[i].first+dif; if (st<=curr) { curr=max(curr,dr); } } if (curr >= len) r = mid; else l = mid; } cout<<fixed<<setprecision(4)<<l; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:21:31: error: 'sqrt' was not declared in this scope; did you mean 'st'?
   21 |                         dif = sqrt((mid*mid)-(a[i].second*a[i].second));
      |                               ^~~~
      |                               st