Submission #573419

# Submission time Handle Problem Language Result Execution time Memory
573419 2022-06-06T15:10:40 Z Rasoul006 Mobile (BOI12_mobile) C++17
0 / 100
702 ms 17056 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) << r << endl ;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 336 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 4 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 1884 KB Output is correct
2 Incorrect 52 ms 1740 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 1912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 1984 KB Output is correct
2 Incorrect 69 ms 1936 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 321 ms 8308 KB Output is correct
2 Correct 343 ms 8464 KB Output is correct
3 Correct 370 ms 8328 KB Output is correct
4 Incorrect 354 ms 8396 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 367 ms 8292 KB Output is correct
2 Incorrect 347 ms 8404 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 435 ms 10000 KB Output is correct
2 Incorrect 408 ms 9880 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 426 ms 10564 KB Output is correct
2 Incorrect 423 ms 10736 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 481 ms 12264 KB Output is correct
2 Incorrect 491 ms 12176 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 547 ms 12124 KB Output is correct
2 Incorrect 498 ms 12300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 544 ms 13868 KB Output is correct
2 Incorrect 556 ms 13828 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 577 ms 13732 KB Output is correct
2 Incorrect 561 ms 13712 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 702 ms 16868 KB Output is correct
2 Incorrect 689 ms 16852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 666 ms 16748 KB Output is correct
2 Incorrect 632 ms 17056 KB Output isn't correct
3 Halted 0 ms 0 KB -