Submission #943347

# Submission time Handle Problem Language Result Execution time Memory
943347 2024-03-11T11:14:28 Z abel2008 Mobile (BOI12_mobile) C++17
Compilation error
0 ms 0 KB
#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

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