Submission #493534

#TimeUsernameProblemLanguageResultExecution timeMemory
493534imaginary_unitMobile (BOI12_mobile)C++17
0 / 100
625 ms27268 KiB
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;

ll 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)
{
    while(r-l>1e-3){
        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, 1.5e9);
    return 0;
}

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:37:13: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   37 |     scanf("%d %d", &n, &len);
      |            ~^      ~~
      |             |      |
      |             int*   long long int*
      |            %lld
mobile.cpp:37:16: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   37 |     scanf("%d %d", &n, &len);
      |               ~^       ~~~~
      |                |       |
      |                int*    long long int*
      |               %lld
mobile.cpp:39:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   39 |         scanf("%d %d", &x[i], &y[i]);
      |                ~^      ~~~~~
      |                 |      |
      |                 int*   long long int*
      |                %lld
mobile.cpp:39:20: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   39 |         scanf("%d %d", &x[i], &y[i]);
      |                   ~^          ~~~~~
      |                    |          |
      |                    int*       long long int*
      |                   %lld
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...