Submission #573424

# Submission time Handle Problem Language Result Execution time Memory
573424 2022-06-06T15:14:11 Z Rasoul006 Mobile (BOI12_mobile) C++17
100 / 100
841 ms 35384 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 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 296 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 5 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 4 ms 472 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 7 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 6 ms 468 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1492 KB Output is correct
2 Correct 54 ms 2596 KB Output is correct
3 Correct 34 ms 1848 KB Output is correct
4 Correct 59 ms 2676 KB Output is correct
5 Correct 32 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 1544 KB Output is correct
2 Correct 50 ms 2180 KB Output is correct
3 Correct 59 ms 2620 KB Output is correct
4 Correct 64 ms 2712 KB Output is correct
5 Correct 72 ms 3056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1644 KB Output is correct
2 Correct 54 ms 2116 KB Output is correct
3 Correct 53 ms 2508 KB Output is correct
4 Correct 84 ms 3736 KB Output is correct
5 Correct 59 ms 2588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 1836 KB Output is correct
2 Correct 74 ms 3236 KB Output is correct
3 Correct 69 ms 2892 KB Output is correct
4 Correct 88 ms 3852 KB Output is correct
5 Correct 71 ms 3144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1844 KB Output is correct
2 Correct 70 ms 2380 KB Output is correct
3 Correct 66 ms 2900 KB Output is correct
4 Correct 85 ms 3756 KB Output is correct
5 Correct 72 ms 3168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 293 ms 8216 KB Output is correct
2 Correct 363 ms 9184 KB Output is correct
3 Correct 342 ms 9292 KB Output is correct
4 Correct 413 ms 9248 KB Output is correct
5 Correct 373 ms 15068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 366 ms 8088 KB Output is correct
2 Correct 449 ms 9184 KB Output is correct
3 Correct 317 ms 13904 KB Output is correct
4 Correct 416 ms 17608 KB Output is correct
5 Correct 367 ms 15380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 356 ms 9764 KB Output is correct
2 Correct 432 ms 10704 KB Output is correct
3 Correct 417 ms 18604 KB Output is correct
4 Correct 516 ms 21648 KB Output is correct
5 Correct 437 ms 17784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 426 ms 9712 KB Output is correct
2 Correct 522 ms 9688 KB Output is correct
3 Correct 385 ms 16632 KB Output is correct
4 Correct 513 ms 21604 KB Output is correct
5 Correct 442 ms 18380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 410 ms 11272 KB Output is correct
2 Correct 486 ms 11240 KB Output is correct
3 Correct 480 ms 21500 KB Output is correct
4 Correct 585 ms 24828 KB Output is correct
5 Correct 501 ms 20336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 510 ms 11312 KB Output is correct
2 Correct 588 ms 11284 KB Output is correct
3 Correct 449 ms 19668 KB Output is correct
4 Correct 608 ms 24764 KB Output is correct
5 Correct 516 ms 21348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 467 ms 12832 KB Output is correct
2 Correct 564 ms 12928 KB Output is correct
3 Correct 549 ms 24404 KB Output is correct
4 Correct 675 ms 28420 KB Output is correct
5 Correct 595 ms 24028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 592 ms 13360 KB Output is correct
2 Correct 664 ms 13392 KB Output is correct
3 Correct 509 ms 22376 KB Output is correct
4 Correct 681 ms 28300 KB Output is correct
5 Correct 599 ms 24400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 605 ms 16684 KB Output is correct
2 Correct 700 ms 16768 KB Output is correct
3 Correct 703 ms 30412 KB Output is correct
4 Correct 840 ms 35296 KB Output is correct
5 Correct 738 ms 29748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 727 ms 17212 KB Output is correct
2 Correct 841 ms 17112 KB Output is correct
3 Correct 656 ms 28200 KB Output is correct
4 Correct 821 ms 35384 KB Output is correct
5 Correct 752 ms 30716 KB Output is correct