Submission #493538

# Submission time Handle Problem Language Result Execution time Memory
493538 2021-12-11T22:14:34 Z imaginary_unit Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 16200 KB
#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)
{
    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("%I64d %I64d", &n, &len);
    for(int i=0; i<n; i++){
        scanf("%I64d %I64d", &x[i], &y[i]);
    }
    cout << fixed << setprecision(4) << MinRadius(1, 1.5e9);
    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:37:16: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   37 |     scanf("%I64d %I64d", &n, &len);
      |            ~~~~^         ~~
      |                |         |
      |                int*      long long int*
      |            %I64lld
mobile.cpp:37:22: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   37 |     scanf("%I64d %I64d", &n, &len);
      |                  ~~~~^       ~~~~
      |                      |       |
      |                      int*    long long int*
      |                  %I64lld
mobile.cpp:39:20: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   39 |         scanf("%I64d %I64d", &x[i], &y[i]);
      |                ~~~~^         ~~~~~
      |                    |         |
      |                    int*      long long int*
      |                %I64lld
mobile.cpp:39:26: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   39 |         scanf("%I64d %I64d", &x[i], &y[i]);
      |                      ~~~~^          ~~~~~
      |                          |          |
      |                          int*       long long int*
      |                      %I64lld
mobile.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     scanf("%I64d %I64d", &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("%I64d %I64d", &x[i], &y[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 408 KB Output is correct
2 Correct 7 ms 332 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Incorrect 10 ms 460 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 152 ms 1536 KB Output is correct
2 Correct 98 ms 1860 KB Output is correct
3 Correct 67 ms 1388 KB Output is correct
4 Incorrect 153 ms 1848 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 1640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 84 ms 1672 KB Output is correct
2 Correct 112 ms 1948 KB Output is correct
3 Correct 109 ms 2052 KB Output is correct
4 Incorrect 238 ms 2652 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 146 ms 2068 KB Output is correct
2 Correct 130 ms 2372 KB Output is correct
3 Correct 115 ms 2332 KB Output is correct
4 Incorrect 243 ms 2696 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 1880 KB Output is correct
2 Correct 132 ms 2312 KB Output is correct
3 Correct 112 ms 2264 KB Output is correct
4 Incorrect 227 ms 2592 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 480 ms 8260 KB Output is correct
2 Correct 676 ms 8604 KB Output is correct
3 Correct 625 ms 8864 KB Output is correct
4 Execution timed out 1083 ms 8896 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 680 ms 8420 KB Output is correct
2 Correct 891 ms 8840 KB Output is correct
3 Correct 586 ms 8844 KB Output is correct
4 Execution timed out 1082 ms 8812 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 581 ms 9800 KB Output is correct
2 Correct 861 ms 10244 KB Output is correct
3 Correct 745 ms 10596 KB Output is correct
4 Execution timed out 1088 ms 10416 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 834 ms 9984 KB Output is correct
2 Execution timed out 1046 ms 10428 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 682 ms 11376 KB Output is correct
2 Correct 931 ms 11680 KB Output is correct
3 Correct 869 ms 11972 KB Output is correct
4 Execution timed out 1041 ms 12120 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1010 ms 11648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 821 ms 12840 KB Output is correct
2 Execution timed out 1036 ms 13636 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 13128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 16200 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 15940 KB Time limit exceeded
2 Halted 0 ms 0 KB -