Submission #493531

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

int n, l, 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 >= l;
}

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 r;
}

int main()
{
    scanf("%d %d", &n, &l);
    for(int i=0; i<n; i++){
        scanf("%d %d", &x[i], &y[i]);
    }
    cout << fixed << setprecision(3) << 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, &l);
      |     ~~~~~^~~~~~~~~~~~~~~~~
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 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 1 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 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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
# Verdict Execution time Memory Grader output
1 Correct 4 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
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 392 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Incorrect 6 ms 424 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1660 KB Output is correct
2 Incorrect 36 ms 1868 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 43 ms 1612 KB Output is correct
2 Correct 42 ms 1596 KB Output is correct
3 Incorrect 85 ms 1948 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1648 KB Output is correct
2 Incorrect 39 ms 2092 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 2628 KB Output is correct
2 Incorrect 47 ms 2484 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2596 KB Output is correct
2 Incorrect 48 ms 2484 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 233 ms 8584 KB Output is correct
2 Incorrect 238 ms 11908 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 243 ms 11156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 259 ms 10064 KB Output is correct
2 Incorrect 295 ms 14304 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 285 ms 11520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 300 ms 11804 KB Output is correct
2 Incorrect 320 ms 16624 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 323 ms 11984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 338 ms 13484 KB Output is correct
2 Incorrect 365 ms 17860 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 371 ms 12880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 429 ms 14876 KB Output is correct
2 Incorrect 490 ms 19268 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 461 ms 12824 KB Output isn't correct
2 Halted 0 ms 0 KB -