답안 #999877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999877 2024-06-16T08:07:05 Z vjudge1 Mobile (BOI12_mobile) C++17
100 / 100
638 ms 35576 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define int long long
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (b); i >= (a); i --)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPD(i, n) for (int i = (n) - 1; i >= 0; --i)

#define MASK(i) (1LL << (i))
#define BIT(x, i) (((x) >> (i)) & 1)


constexpr ll LINF = (1ll << 60);
constexpr int INF = (1ll << 30);
constexpr int Mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
    Phu Trong from Nguyen Tat Thanh High School for gifted student
*/

template <class X, class Y>
    bool minimize(X &x, const Y &y){
        X eps = 1e-9;
        if (x > y + eps) {x = y; return 1;}
        return 0;
    }

template <class X, class Y>
    bool maximize(X &x, const Y &y){
        X eps = 1e-9;
        if (x + eps < y) {x = y; return 1;}
        return 0;
    }

#define MAX     1000005
int numPoint;
double lim;
struct Point{
    double x, y;
    Point(){}
    Point(double _x, double _y): x(_x), y(_y){}
} A[MAX];

const double eps = 1e-5;

double dist(Point a, Point b){
    return (double)(sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)));
}
signed main(){
    #define name "Whisper"
    cin.tie(nullptr) -> sync_with_stdio(false);
    //freopen(name".inp", "r", stdin);
    //freopen(name".out", "w", stdout);
    cin >> numPoint >> lim;
    for (int i = 1; i <= numPoint; ++i){
        cin >> A[i].x >> A[i].y;
    }
    double ans = 0.0;
    double l = 1, r = 1.5e9;

    auto check = [&](double dist) -> bool{
        double cur = 0;
        for (int i = 1; i <= numPoint; ++i){
            double l = A[i].x - sqrt(dist * dist - A[i].y * A[i].y);
            double r = A[i].x + sqrt(dist * dist - A[i].y * A[i].y);
            if (l <= cur) maximize(cur, r);
        }
        return cur >= lim;
    };

    while (r - l > eps){
        double m = (l + r) / 2;
        if(check(m)) r = m;
        else l = m;
    }
    cout << setprecision(5) << fixed << r;
}



Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:62:12: warning: unused variable 'ans' [-Wunused-variable]
   62 |     double ans = 0.0;
      |            ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 4 ms 600 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 2648 KB Output is correct
2 Correct 32 ms 2652 KB Output is correct
3 Correct 24 ms 3164 KB Output is correct
4 Correct 48 ms 3676 KB Output is correct
5 Correct 25 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 2904 KB Output is correct
2 Correct 39 ms 2648 KB Output is correct
3 Correct 45 ms 2652 KB Output is correct
4 Correct 47 ms 3672 KB Output is correct
5 Correct 59 ms 4084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 2648 KB Output is correct
2 Correct 33 ms 2680 KB Output is correct
3 Correct 37 ms 3420 KB Output is correct
4 Correct 66 ms 4444 KB Output is correct
5 Correct 48 ms 3420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 2652 KB Output is correct
2 Correct 43 ms 3956 KB Output is correct
3 Correct 54 ms 3700 KB Output is correct
4 Correct 66 ms 4436 KB Output is correct
5 Correct 57 ms 3920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 2648 KB Output is correct
2 Correct 42 ms 3928 KB Output is correct
3 Correct 43 ms 3584 KB Output is correct
4 Correct 67 ms 4624 KB Output is correct
5 Correct 55 ms 3952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 9044 KB Output is correct
2 Correct 204 ms 16472 KB Output is correct
3 Correct 202 ms 15956 KB Output is correct
4 Correct 315 ms 18260 KB Output is correct
5 Correct 279 ms 15444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 202 ms 8788 KB Output is correct
2 Correct 315 ms 15340 KB Output is correct
3 Correct 207 ms 14420 KB Output is correct
4 Correct 319 ms 18292 KB Output is correct
5 Correct 307 ms 15952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 218 ms 10832 KB Output is correct
2 Correct 246 ms 20056 KB Output is correct
3 Correct 257 ms 19540 KB Output is correct
4 Correct 390 ms 22648 KB Output is correct
5 Correct 336 ms 18792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 253 ms 10880 KB Output is correct
2 Correct 366 ms 18808 KB Output is correct
3 Correct 259 ms 17492 KB Output is correct
4 Correct 372 ms 22612 KB Output is correct
5 Correct 354 ms 19444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 247 ms 12884 KB Output is correct
2 Correct 281 ms 23632 KB Output is correct
3 Correct 279 ms 22864 KB Output is correct
4 Correct 450 ms 26452 KB Output is correct
5 Correct 385 ms 21736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 288 ms 12936 KB Output is correct
2 Correct 445 ms 21996 KB Output is correct
3 Correct 296 ms 21076 KB Output is correct
4 Correct 506 ms 26196 KB Output is correct
5 Correct 415 ms 22868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 289 ms 14928 KB Output is correct
2 Correct 326 ms 27220 KB Output is correct
3 Correct 328 ms 26448 KB Output is correct
4 Correct 507 ms 30440 KB Output is correct
5 Correct 448 ms 25940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 337 ms 14932 KB Output is correct
2 Correct 481 ms 25720 KB Output is correct
3 Correct 342 ms 24404 KB Output is correct
4 Correct 485 ms 30328 KB Output is correct
5 Correct 459 ms 26360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 346 ms 15952 KB Output is correct
2 Correct 404 ms 31572 KB Output is correct
3 Correct 405 ms 30632 KB Output is correct
4 Correct 638 ms 35188 KB Output is correct
5 Correct 565 ms 29772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 456 ms 16208 KB Output is correct
2 Correct 577 ms 29252 KB Output is correct
3 Correct 439 ms 28496 KB Output is correct
4 Correct 598 ms 35576 KB Output is correct
5 Correct 555 ms 30800 KB Output is correct