Submission #112589

# Submission time Handle Problem Language Result Execution time Memory
112589 2019-05-20T18:18:42 Z zoooma13 Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 10744 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(y[i]-X > 1e-6)
            continue;
        double len = sqrt((X*X)-(1.0*y[i]*y[i]));
        if(x[i]-len-mx > 1e-6)
            return 0;
        mx = max(mx ,x[i]+len);
    }
    return (mx >= l);
}

int main()
{
    scanf("%d%d",&n,&l);
    for(int lx=-2e9 ,i=0; i<n; i++)
    {
        scanf("%d%d",&x[i],&y[i]) ,y[i] = abs(y[i]);
        if(lx == x[i]){
            y[i-1] = min(y[i-1] ,y[i]);
            i-- ,n--;
        }lx = x[i];
    }

    double st = 0 ,en = 1e18 ,mid;
    for(int ee=200; 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:28: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 9 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 2 ms 384 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 5 ms 356 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Incorrect 3 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 107 ms 1692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 164 ms 1724 KB Output is correct
2 Incorrect 84 ms 1920 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 2236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 142 ms 2656 KB Output is correct
2 Incorrect 77 ms 2040 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 833 ms 6880 KB Output is correct
2 Correct 119 ms 2920 KB Output is correct
3 Correct 106 ms 2936 KB Output is correct
4 Incorrect 357 ms 6784 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 194 ms 2936 KB Output is correct
2 Incorrect 725 ms 6792 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 7672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 140 ms 2808 KB Output is correct
2 Incorrect 968 ms 7516 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 8308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 148 ms 2680 KB Output is correct
2 Execution timed out 1069 ms 8184 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 9012 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 161 ms 2812 KB Output is correct
2 Execution timed out 1082 ms 9288 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 10516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 207 ms 516 KB Output is correct
2 Execution timed out 1048 ms 10744 KB Time limit exceeded
3 Halted 0 ms 0 KB -