Submission #573417

# Submission time Handle Problem Language Result Execution time Memory
573417 2022-06-06T15:09:02 Z Rasoul006 Mobile (BOI12_mobile) C++17
0 / 100
555 ms 18824 KB
#include <bits/stdc++.h>

#define endl "\n"

#define F first

#define S second

#define pb push_back

#define all(x) x.begin() , x.end()

#define mm1(dp) memset (dp , -1 , sizeof dp)

#define mm0(dp) memset (dp , 0 , sizeof dp)

#define mmo(dp) memset (dp , oo , sizeof dp)

//#define mid ((r+l)/2.0)

#define lx (n<<1)

#define rx ((n<<1)|1)

typedef long long ll;

using namespace std;

const int N = 1e6+5;

const int MOD = 1e9+7;

const long long oo = 4557430888798830399 ;

ll n ;
double le , x[N] , y[N] ;

bool ch(double m)
{
    double la = 0 ;

    for (int i = 0 ; i<n ; i++)
    {
        double p = sqrt((m*m) - (y[i]*y[i]));

//        cout << p << " " << x[i] - p << " " << la << endl ;

        if (x[i]-p <= la)
        {
            la = max (x[i]+p , la);

            if (la>=le)
                return true ;
        }
        else
        {
            return false ;
        }
    }

    return (la>=le ? true : false) ;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin >> n >> le ;

    for (int i = 0 ; i<n ; i++)
    {
        cin >> x[i] >> y[i] ;
    }

    double l = 0 , r = 1e18 ;

    while (r-l > 0.0000001)
    {
        double mid = (r+l)/2.0 ;

        if (ch(mid))
        {
            r = mid ;
        }
        else
        {
            l = mid ;
        }
    }

    cout <<fixed << setprecision(6) << r << endl ;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 2256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 2232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 60 ms 2300 KB Output is correct
2 Incorrect 49 ms 2764 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 3368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 61 ms 3432 KB Output is correct
2 Incorrect 51 ms 3252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 305 ms 12360 KB Output is correct
2 Correct 263 ms 10936 KB Output is correct
3 Correct 288 ms 10872 KB Output is correct
4 Incorrect 293 ms 10680 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 245 ms 10988 KB Output is correct
2 Incorrect 293 ms 11028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 306 ms 13396 KB Output is correct
2 Incorrect 314 ms 12392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 296 ms 12052 KB Output is correct
2 Incorrect 357 ms 12560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 391 ms 14416 KB Output is correct
2 Incorrect 343 ms 13352 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 363 ms 13348 KB Output is correct
2 Incorrect 350 ms 14084 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 441 ms 15660 KB Output is correct
2 Incorrect 388 ms 15060 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 415 ms 14876 KB Output is correct
2 Incorrect 424 ms 14908 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 518 ms 18824 KB Output is correct
2 Incorrect 509 ms 17972 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 555 ms 17140 KB Output is correct
2 Incorrect 527 ms 17696 KB Output isn't correct
3 Halted 0 ms 0 KB -