Submission #940688

# Submission time Handle Problem Language Result Execution time Memory
940688 2024-03-07T13:26:21 Z sleepntsheep Mobile (BOI12_mobile) C++17
100 / 100
888 ms 35412 KB
#include<stdio.h>
#include<math.h>
#define N 1000000



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=160;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.cpp: In function 'int main()':
mobile.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d%d",&n,&L);
      |     ~~~~~^~~~~~~~~~~~~~
mobile.cpp:13:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     for(int i=0;i<n;++i)scanf("%lf%lf",x+i,y+i);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 3 ms 2392 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 3 ms 2540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2396 KB Output is correct
2 Correct 4 ms 2488 KB Output is correct
3 Correct 3 ms 2392 KB Output is correct
4 Correct 3 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Correct 4 ms 2488 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 3 ms 2556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2396 KB Output is correct
2 Correct 4 ms 2396 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 3 ms 2584 KB Output is correct
5 Correct 3 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 3676 KB Output is correct
2 Correct 52 ms 3676 KB Output is correct
3 Correct 32 ms 3376 KB Output is correct
4 Correct 31 ms 3756 KB Output is correct
5 Correct 19 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 3420 KB Output is correct
2 Correct 29 ms 3676 KB Output is correct
3 Correct 32 ms 3672 KB Output is correct
4 Correct 32 ms 3676 KB Output is correct
5 Correct 45 ms 3928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 3416 KB Output is correct
2 Correct 56 ms 3860 KB Output is correct
3 Correct 50 ms 3676 KB Output is correct
4 Correct 39 ms 4436 KB Output is correct
5 Correct 35 ms 3916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 4436 KB Output is correct
2 Correct 73 ms 4176 KB Output is correct
3 Correct 59 ms 3924 KB Output is correct
4 Correct 41 ms 4436 KB Output is correct
5 Correct 39 ms 3936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 4256 KB Output is correct
2 Correct 70 ms 4184 KB Output is correct
3 Correct 63 ms 3996 KB Output is correct
4 Correct 39 ms 4432 KB Output is correct
5 Correct 45 ms 3916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 337 ms 14416 KB Output is correct
2 Correct 342 ms 15896 KB Output is correct
3 Correct 346 ms 15552 KB Output is correct
4 Correct 187 ms 16820 KB Output is correct
5 Correct 220 ms 15184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 351 ms 16408 KB Output is correct
2 Correct 558 ms 15188 KB Output is correct
3 Correct 291 ms 14872 KB Output is correct
4 Correct 188 ms 16652 KB Output is correct
5 Correct 200 ms 15636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 394 ms 14836 KB Output is correct
2 Correct 455 ms 16724 KB Output is correct
3 Correct 411 ms 16468 KB Output is correct
4 Correct 235 ms 18132 KB Output is correct
5 Correct 219 ms 16092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 407 ms 17428 KB Output is correct
2 Correct 629 ms 15900 KB Output is correct
3 Correct 347 ms 15384 KB Output is correct
4 Correct 233 ms 17748 KB Output is correct
5 Correct 229 ms 16632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 474 ms 17236 KB Output is correct
2 Correct 476 ms 19540 KB Output is correct
3 Correct 475 ms 19200 KB Output is correct
4 Correct 269 ms 20764 KB Output is correct
5 Correct 257 ms 18516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 474 ms 20252 KB Output is correct
2 Correct 681 ms 18708 KB Output is correct
3 Correct 403 ms 18000 KB Output is correct
4 Correct 269 ms 20564 KB Output is correct
5 Correct 261 ms 19024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 540 ms 16672 KB Output is correct
2 Correct 539 ms 15892 KB Output is correct
3 Correct 537 ms 15896 KB Output is correct
4 Correct 321 ms 15904 KB Output is correct
5 Correct 294 ms 15900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 549 ms 15956 KB Output is correct
2 Correct 762 ms 15956 KB Output is correct
3 Correct 474 ms 15900 KB Output is correct
4 Correct 309 ms 15904 KB Output is correct
5 Correct 353 ms 15888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 657 ms 16208 KB Output is correct
2 Correct 669 ms 16144 KB Output is correct
3 Correct 667 ms 16056 KB Output is correct
4 Correct 377 ms 15952 KB Output is correct
5 Correct 375 ms 16052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 687 ms 16052 KB Output is correct
2 Correct 888 ms 15956 KB Output is correct
3 Correct 625 ms 28352 KB Output is correct
4 Correct 386 ms 35412 KB Output is correct
5 Correct 373 ms 30800 KB Output is correct