답안 #729575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
729575 2023-04-24T09:17:34 Z PanosPask Mobile (BOI12_mobile) C++14
85 / 100
1000 ms 25396 KB
#include <bits/stdc++.h>

using namespace std;

typedef pair<long long, long long > pl;

int n, l;
vector<pl> transmitters;

bool distance_covers(double x)
{
    double latest_cover = 0;
    for (int i = 0; i < n && latest_cover < l; i++) {
        pl cur = transmitters[i];
        if (cur.second > x)
            continue;

        double k = sqrt(x * x - cur.second * cur.second);

        if (cur.first - k <= latest_cover)
            latest_cover = max(latest_cover, cur.first + k);
    }

    return latest_cover >= l;
}

int main(void)
{
    scanf("%d %d", &n, &l);
    transmitters.resize(n);
    for (int i = 0; i < n; i++)
        scanf("%lld %lld", &transmitters[i].first, &transmitters[i].second);

    double l = 0; //distance_covers(l) = false
    double r = 1; //distance_covers(r) = true
    while (!distance_covers(r)) {
        l = r;
        r *= 2;
    }

    for (int i = 0; i < 50; i++) {
        double mid = (l + r) / 2;
        if (distance_covers(mid))
            r = mid;
        else
            l = mid;
    }

    printf("%lf\n", r);
    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |     scanf("%d %d", &n, &l);
      |     ~~~~~^~~~~~~~~~~~~~~~~
mobile.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         scanf("%lld %lld", &transmitters[i].first, &transmitters[i].second);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 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 5 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 372 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 5 ms 372 KB Output is correct
# 결과 실행 시간 메모리 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 5 ms 372 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 1364 KB Output is correct
2 Correct 37 ms 1492 KB Output is correct
3 Correct 18 ms 1152 KB Output is correct
4 Correct 73 ms 1364 KB Output is correct
5 Correct 22 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 1508 KB Output is correct
2 Correct 58 ms 1364 KB Output is correct
3 Correct 72 ms 1492 KB Output is correct
4 Correct 75 ms 1528 KB Output is correct
5 Correct 86 ms 1648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 1664 KB Output is correct
2 Correct 36 ms 1492 KB Output is correct
3 Correct 26 ms 1620 KB Output is correct
4 Correct 103 ms 1848 KB Output is correct
5 Correct 64 ms 1684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 1876 KB Output is correct
2 Correct 43 ms 1748 KB Output is correct
3 Correct 33 ms 1856 KB Output is correct
4 Correct 114 ms 1860 KB Output is correct
5 Correct 90 ms 1856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 1860 KB Output is correct
2 Correct 51 ms 1748 KB Output is correct
3 Correct 30 ms 1748 KB Output is correct
4 Correct 96 ms 1852 KB Output is correct
5 Correct 85 ms 1800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 261 ms 8124 KB Output is correct
2 Correct 166 ms 8120 KB Output is correct
3 Correct 155 ms 8120 KB Output is correct
4 Correct 510 ms 8116 KB Output is correct
5 Correct 438 ms 8120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 206 ms 8116 KB Output is correct
2 Correct 316 ms 8116 KB Output is correct
3 Correct 166 ms 8124 KB Output is correct
4 Correct 485 ms 8020 KB Output is correct
5 Correct 440 ms 8116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 268 ms 9680 KB Output is correct
2 Correct 209 ms 9684 KB Output is correct
3 Correct 192 ms 9684 KB Output is correct
4 Correct 559 ms 9684 KB Output is correct
5 Correct 525 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 266 ms 9684 KB Output is correct
2 Correct 463 ms 9684 KB Output is correct
3 Correct 208 ms 9684 KB Output is correct
4 Correct 619 ms 9684 KB Output is correct
5 Correct 630 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 453 ms 11248 KB Output is correct
2 Correct 266 ms 11248 KB Output is correct
3 Correct 243 ms 11248 KB Output is correct
4 Correct 741 ms 11248 KB Output is correct
5 Correct 607 ms 20272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 295 ms 11248 KB Output is correct
2 Correct 812 ms 11252 KB Output is correct
3 Correct 258 ms 19628 KB Output is correct
4 Correct 765 ms 20536 KB Output is correct
5 Correct 692 ms 20540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 447 ms 12820 KB Output is correct
2 Correct 314 ms 12816 KB Output is correct
3 Correct 350 ms 12812 KB Output is correct
4 Correct 863 ms 12812 KB Output is correct
5 Correct 758 ms 22104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 319 ms 12756 KB Output is correct
2 Correct 508 ms 12812 KB Output is correct
3 Correct 329 ms 22232 KB Output is correct
4 Execution timed out 1066 ms 22124 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 600 ms 15980 KB Output is correct
2 Correct 494 ms 16072 KB Output is correct
3 Correct 347 ms 15964 KB Output is correct
4 Execution timed out 1030 ms 16060 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 464 ms 16148 KB Output is correct
2 Correct 597 ms 16092 KB Output is correct
3 Correct 380 ms 25396 KB Output is correct
4 Execution timed out 1069 ms 16236 KB Time limit exceeded
5 Halted 0 ms 0 KB -