Submission #493533

# Submission time Handle Problem Language Result Execution time Memory
493533 2021-12-11T21:58:07 Z imaginary_unit Mobile (BOI12_mobile) C++17
12 / 100
475 ms 8096 KB
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;

int n, len, x[1'000'000], y[1'000'000];

bool ok(double r)
{
    double cur=0;
    for(int i=0; i<n; i++){
        double delta=sqrt(r*r-y[i]*y[i]), a=x[i]-delta, b=x[i]+delta;
        if(a<=cur){
            cur=max(cur, b);
        }
    }
    return cur >= len;
}

double MinRadius(double l, double r)
{
    for(int i=0; i<100; i++){
        double m=(l+r)/2;
        if(ok(m)){
            r=m;
        }
        else{
            l=m;
        }
    }
    return l;
}

int main()
{
    scanf("%d %d", &n, &len);
    for(int i=0; i<n; i++){
        scanf("%d %d", &x[i], &y[i]);
    }
    cout << fixed << setprecision(4) << MinRadius(0, 1e9+1);
    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     scanf("%d %d", &n, &len);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
mobile.cpp:39:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         scanf("%d %d", &x[i], &y[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Incorrect 5 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Incorrect 6 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Incorrect 6 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 71 ms 880 KB Output is correct
2 Incorrect 39 ms 892 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 43 ms 908 KB Output is correct
2 Correct 48 ms 860 KB Output is correct
3 Incorrect 79 ms 1008 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 968 KB Output is correct
2 Incorrect 38 ms 844 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1076 KB Output is correct
2 Incorrect 46 ms 1016 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1084 KB Output is correct
2 Incorrect 51 ms 972 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 219 ms 4204 KB Output is correct
2 Incorrect 235 ms 4200 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 234 ms 4308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 258 ms 5100 KB Output is correct
2 Incorrect 283 ms 5068 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 277 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 304 ms 5764 KB Output is correct
2 Incorrect 310 ms 5684 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 316 ms 5760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 327 ms 6624 KB Output is correct
2 Incorrect 355 ms 6468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 379 ms 6592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 445 ms 8096 KB Output is correct
2 Incorrect 453 ms 8096 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 475 ms 8024 KB Output isn't correct
2 Halted 0 ms 0 KB -