Submission #112571

# Submission time Handle Problem Language Result Execution time Memory
112571 2019-05-20T16:21:30 Z zoooma13 Mobile (BOI12_mobile) C++14
0 / 100
901 ms 24720 KB
#include <bits/stdc++.h>
using namespace std;

#define MAX_N 1000006

int n ,l;
int x[MAX_N] ,y[MAX_N];

bool can(double X)
{
    double mx = 0;
    for(int i=0; i<n; i++){
        if(X < y[i])
            continue;
        double len = sqrt((X*X)-(1.0*y[i]*y[i]));
        if(mx < x[i]-len)
            return 0;
        mx = max(mx ,x[i]+len);
    }
    return (mx >= l);
}

int main()
{
    scanf("%d%d",&n,&l);
    for(int i=0; i<n; i++)
        scanf("%d%d",&x[i],&y[i]) ,y[i] = abs(y[i]);

    double st = 0 ,en = 1e10 ,mid;
    for(int ee=100; ee; ee--){
        mid = (st+en)/2;
        if(can(mid))
            en = mid;
        else
            st = mid;
    }

    cout << fixed << setprecision(6) << en << endl;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&l);
     ~~~~~^~~~~~~~~~~~~~
mobile.cpp:27:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x[i],&y[i]) ,y[i] = abs(y[i]);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 1792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 1756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 1756 KB Output is correct
2 Incorrect 40 ms 2168 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 92 ms 2688 KB Output is correct
2 Incorrect 89 ms 2588 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 461 ms 8696 KB Output is correct
2 Correct 392 ms 12024 KB Output is correct
3 Correct 375 ms 11640 KB Output is correct
4 Incorrect 206 ms 13988 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 394 ms 12512 KB Output is correct
2 Incorrect 439 ms 11000 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 628 ms 10240 KB Output is correct
2 Incorrect 300 ms 14352 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 277 ms 15092 KB Output is correct
2 Incorrect 503 ms 13076 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 652 ms 12024 KB Output is correct
2 Incorrect 320 ms 16760 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 333 ms 17408 KB Output is correct
2 Incorrect 559 ms 15144 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 710 ms 13684 KB Output is correct
2 Incorrect 622 ms 19064 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 620 ms 19804 KB Output is correct
2 Incorrect 624 ms 17272 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 901 ms 16972 KB Output is correct
2 Incorrect 766 ms 23800 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 748 ms 24720 KB Output is correct
2 Incorrect 725 ms 21500 KB Output isn't correct
3 Halted 0 ms 0 KB -