Submission #1255744

#TimeUsernameProblemLanguageResultExecution timeMemory
1255744NipphitchMobile (BOI12_mobile)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define double 
const int N=1e6+5;

int n,len,x[N],y[N];

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> len;
    for(int i=1;i<=n;i++) cin >> x[i] >> y[i];
    double l=0.00,r=1.5e9;
    while(r-l>1e-3){
        double mid=(l+r)/2;
        double cur=0;
        for(int i=1;i<=n;i++){
            double d=sqrt(mid*mid-y[i]*y[i]);
            double a=x[i]-d,b=x[i]+d;
            if(a<=cur) cur=max(cur,b);
        }
        if(cur>=len) r=mid;
        else l=mid;
    }
    cout << fixed << setprecision(4) << l;
}

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:15:12: error: 'l' was not declared in this scope
   15 |     double l=0.00,r=1.5e9;
      |            ^
mobile.cpp:15:19: error: 'r' was not declared in this scope
   15 |     double l=0.00,r=1.5e9;
      |                   ^
mobile.cpp:17:16: error: 'mid' was not declared in this scope
   17 |         double mid=(l+r)/2;
      |                ^~~
mobile.cpp:18:16: error: 'cur' was not declared in this scope
   18 |         double cur=0;
      |                ^~~
mobile.cpp:20:20: error: 'd' was not declared in this scope
   20 |             double d=sqrt(mid*mid-y[i]*y[i]);
      |                    ^
mobile.cpp:21:20: error: 'a' was not declared in this scope
   21 |             double a=x[i]-d,b=x[i]+d;
      |                    ^
mobile.cpp:21:29: error: 'b' was not declared in this scope
   21 |             double a=x[i]-d,b=x[i]+d;
      |                             ^