Submission #573423

# Submission time Handle Problem Language Result Execution time Memory
573423 2022-06-06T15:13:32 Z Rasoul006 Mobile (BOI12_mobile) C++17
0 / 100
735 ms 15956 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);
        }
//        
//        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(4) << l  << " " << r << endl ;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 324 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 340 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 340 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 340 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 1916 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 2024 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 2216 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 2376 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 85 ms 2372 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 316 ms 8628 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 407 ms 9168 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 400 ms 10868 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 516 ms 9880 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 430 ms 11372 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 522 ms 11276 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 536 ms 12832 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 606 ms 12796 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 618 ms 15956 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 735 ms 15952 KB Extra information in the output file
2 Halted 0 ms 0 KB -