Submission #940676

# Submission time Handle Problem Language Result Execution time Memory
940676 2024-03-07T13:07:04 Z sleepntsheep Mobile (BOI12_mobile) C++
95 / 100
1000 ms 35408 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=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.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 2 ms 2392 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 0 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 2 ms 2392 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 2 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2392 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 2472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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 2396 KB Output is correct
5 Correct 3 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 3040 KB Output is correct
2 Correct 60 ms 3040 KB Output is correct
3 Correct 37 ms 2648 KB Output is correct
4 Correct 33 ms 2908 KB Output is correct
5 Correct 20 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 3080 KB Output is correct
2 Correct 30 ms 2908 KB Output is correct
3 Correct 34 ms 2908 KB Output is correct
4 Correct 34 ms 2892 KB Output is correct
5 Correct 41 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 3140 KB Output is correct
2 Correct 66 ms 3096 KB Output is correct
3 Correct 61 ms 2904 KB Output is correct
4 Correct 41 ms 3164 KB Output is correct
5 Correct 38 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 3160 KB Output is correct
2 Correct 81 ms 3160 KB Output is correct
3 Correct 67 ms 3164 KB Output is correct
4 Correct 42 ms 3152 KB Output is correct
5 Correct 41 ms 3172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 3164 KB Output is correct
2 Correct 80 ms 3216 KB Output is correct
3 Correct 68 ms 3160 KB Output is correct
4 Correct 42 ms 3160 KB Output is correct
5 Correct 41 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 394 ms 14992 KB Output is correct
2 Correct 402 ms 19340 KB Output is correct
3 Correct 399 ms 19032 KB Output is correct
4 Correct 209 ms 21332 KB Output is correct
5 Correct 248 ms 18516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 406 ms 18104 KB Output is correct
2 Correct 673 ms 18416 KB Output is correct
3 Correct 346 ms 17620 KB Output is correct
4 Correct 202 ms 21328 KB Output is correct
5 Correct 208 ms 19028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 466 ms 16212 KB Output is correct
2 Correct 479 ms 21088 KB Output is correct
3 Correct 488 ms 20412 KB Output is correct
4 Correct 278 ms 23588 KB Output is correct
5 Correct 242 ms 19780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 482 ms 19772 KB Output is correct
2 Correct 756 ms 19740 KB Output is correct
3 Correct 399 ms 18640 KB Output is correct
4 Correct 263 ms 23464 KB Output is correct
5 Correct 241 ms 20524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 578 ms 19024 KB Output is correct
2 Correct 581 ms 24652 KB Output is correct
3 Correct 577 ms 24024 KB Output is correct
4 Correct 287 ms 27664 KB Output is correct
5 Correct 279 ms 22680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 548 ms 23708 KB Output is correct
2 Correct 814 ms 23116 KB Output is correct
3 Correct 468 ms 22124 KB Output is correct
4 Correct 280 ms 27248 KB Output is correct
5 Correct 277 ms 23892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 621 ms 21900 KB Output is correct
2 Correct 635 ms 28564 KB Output is correct
3 Correct 631 ms 27640 KB Output is correct
4 Correct 332 ms 31404 KB Output is correct
5 Correct 332 ms 27100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 635 ms 28500 KB Output is correct
2 Correct 896 ms 26708 KB Output is correct
3 Correct 538 ms 25368 KB Output is correct
4 Correct 337 ms 31632 KB Output is correct
5 Correct 316 ms 27404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 775 ms 24408 KB Output is correct
2 Correct 782 ms 31568 KB Output is correct
3 Correct 790 ms 30616 KB Output is correct
4 Correct 410 ms 35408 KB Output is correct
5 Correct 404 ms 29524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 799 ms 32088 KB Output is correct
2 Execution timed out 1063 ms 29068 KB Time limit exceeded
3 Halted 0 ms 0 KB -