Submission #493541

#TimeUsernameProblemLanguageResultExecution timeMemory
493541imaginary_unitMobile (BOI12_mobile)C++17
0 / 100
1088 ms16252 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];

int main()
{
    scanf("%I64d %I64d", &n, &len);
    for(int i=0; i<n; i++){
        scanf("%I64d %I64d", &x[i], &y[i]);
    }

    double l=1, r=1.5e9;
    while(r-l>1e-3){
        double m=(l+r)/2, cur=0;
        for(int i=0; i<n; i++){
            double delta=sqrt(m*m-y[i]*y[i]);
            double a=x[i]-delta, b=x[i]+delta;
            if(a<=cur){
                cur=max(cur, b);
            }
        }
        if(cur>=len){
            r=m;
        }
        else{
            l=m;
        }
    }
    cout << fixed << setprecision(4) << l;
    return 0;
}

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:11:16: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   11 |     scanf("%I64d %I64d", &n, &len);
      |            ~~~~^         ~~
      |                |         |
      |                int*      long long int*
      |            %I64lld
mobile.cpp:11:22: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   11 |     scanf("%I64d %I64d", &n, &len);
      |                  ~~~~^       ~~~~
      |                      |       |
      |                      int*    long long int*
      |                  %I64lld
mobile.cpp:13:20: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   13 |         scanf("%I64d %I64d", &x[i], &y[i]);
      |                ~~~~^         ~~~~~
      |                    |         |
      |                    int*      long long int*
      |                %I64lld
mobile.cpp:13:26: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   13 |         scanf("%I64d %I64d", &x[i], &y[i]);
      |                      ~~~~^          ~~~~~
      |                          |          |
      |                          int*       long long int*
      |                      %I64lld
mobile.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%I64d %I64d", &n, &len);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%I64d %I64d", &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...