Submission #940673

# Submission time Handle Problem Language Result Execution time Memory
940673 2024-03-07T13:03:51 Z sleepntsheep Mobile (BOI12_mobile) C
Compilation error
0 ms 0 KB
#include<stdio.h>
#include<math.h>
#define N 100000

int n, L;
double x[N], y[N];

int main()
{
    scanf("%d%d",&n,&L);
    for(int i=0;i<n;++i)scanf("%lf%lf",x+i,y+i);
    double l=0,r=1e9;
    for (int iter=200;iter--;)
    {
        double m=(l+r)/2,rr=0;
        for(int i=0;i<n;++i)
        {
            if(m*m>=y[i]*y[i])
            {
                double dx=sqrt(m*m-y[i]*y[i]);
                if(x[i]-dx<=rr)
                    if(x[i]+dx>rr)rr=x[i]+dx;
            }
        }

        if(rr>=L) r=m;
        else l=m;
    }
    printf("%.6lf",r);
    
}

Compilation message

mobile.c: In function 'main':
mobile.c:10:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d%d",&n,&L);
      |     ^~~~~~~~~~~~~~~~~~~
mobile.c:11:25: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for(int i=0;i<n;++i)scanf("%lf%lf",x+i,y+i);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccp58ARX.o: in function `main':
mobile.c:(.text.startup+0x1d4): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status