답안 #1056905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056905 2024-08-13T12:17:16 Z TimAni Mobile (BOI12_mobile) C++17
100 / 100
287 ms 18256 KB
// time-limit: 3000
 
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
const double eps = 1E-4;
 
struct point {
    int x{}, y{};
};
 
void solve() {
    int n, L;
    cin >> n >> L;
    vector<point> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y;
    }
    auto intersection = [&](const point& A, double R) -> array<double, 2> {
        if(abs(A.y) > R) {
            return {L, -1};
        }
        double D = 1.0 * R * R - 1.0 * A.y * A.y; // divided by 4
        double x1 = A.x - sqrt(D);
        double x2 = A.x + sqrt(D);
        if(x2 < x1) swap(x1, x2);
        return {x1, x2};
    };
 
    auto good = [&](double R) {
        double t = 0;
        for(int i = 0; i < n; i++) {
            auto [l, r] = intersection(p[i], R);
            if(l <= t && r >= t) t = r;
        }
        return t >= L;
    };
 
    double l = 0, r = 4e9;
    while(r - l > eps) {
        double R = (r + l) / 2;
        if(good(R)) {
            r = R;
        }
        else {
            l = R;
        }
        
    }
    cout << fixed << setprecision(-log10(eps)) << r << endl;
}
 
int main() {
    cin.tie(0)->sync_with_stdio(0);
    double T = 1;
    //cin >> T;
    while(T--) solve();
    return 0;
}

Compilation message

mobile.cpp: In lambda function:
mobile.cpp:23:21: warning: narrowing conversion of 'L' from 'int' to 'double' [-Wnarrowing]
   23 |             return {L, -1};
      |                     ^
# 결과 실행 시간 메모리 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 0 ms 348 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 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 860 KB Output is correct
2 Correct 16 ms 1832 KB Output is correct
3 Correct 13 ms 1372 KB Output is correct
4 Correct 15 ms 1628 KB Output is correct
5 Correct 9 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 860 KB Output is correct
2 Correct 14 ms 1772 KB Output is correct
3 Correct 16 ms 1628 KB Output is correct
4 Correct 16 ms 1624 KB Output is correct
5 Correct 17 ms 2028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 1160 KB Output is correct
2 Correct 17 ms 1108 KB Output is correct
3 Correct 16 ms 1116 KB Output is correct
4 Correct 20 ms 1112 KB Output is correct
5 Correct 17 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 1116 KB Output is correct
2 Correct 21 ms 1116 KB Output is correct
3 Correct 18 ms 1116 KB Output is correct
4 Correct 20 ms 1112 KB Output is correct
5 Correct 19 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 1116 KB Output is correct
2 Correct 21 ms 1248 KB Output is correct
3 Correct 19 ms 1256 KB Output is correct
4 Correct 20 ms 1112 KB Output is correct
5 Correct 22 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 4316 KB Output is correct
2 Correct 110 ms 8336 KB Output is correct
3 Correct 105 ms 8016 KB Output is correct
4 Correct 112 ms 9300 KB Output is correct
5 Correct 96 ms 7820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 105 ms 4188 KB Output is correct
2 Correct 165 ms 8020 KB Output is correct
3 Correct 94 ms 7304 KB Output is correct
4 Correct 98 ms 9220 KB Output is correct
5 Correct 92 ms 8028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 131 ms 4952 KB Output is correct
2 Correct 130 ms 10004 KB Output is correct
3 Correct 126 ms 9556 KB Output is correct
4 Correct 116 ms 11088 KB Output is correct
5 Correct 112 ms 9296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 5144 KB Output is correct
2 Correct 196 ms 9236 KB Output is correct
3 Correct 124 ms 8528 KB Output is correct
4 Correct 115 ms 11268 KB Output is correct
5 Correct 111 ms 9620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 137 ms 5720 KB Output is correct
2 Correct 167 ms 11344 KB Output is correct
3 Correct 148 ms 11300 KB Output is correct
4 Correct 134 ms 12624 KB Output is correct
5 Correct 129 ms 10580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 151 ms 5724 KB Output is correct
2 Correct 210 ms 10580 KB Output is correct
3 Correct 133 ms 10280 KB Output is correct
4 Correct 147 ms 12884 KB Output is correct
5 Correct 133 ms 11092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 6492 KB Output is correct
2 Correct 177 ms 12880 KB Output is correct
3 Correct 167 ms 12728 KB Output is correct
4 Correct 160 ms 14672 KB Output is correct
5 Correct 155 ms 12368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 169 ms 6492 KB Output is correct
2 Correct 256 ms 12196 KB Output is correct
3 Correct 151 ms 11612 KB Output is correct
4 Correct 153 ms 14416 KB Output is correct
5 Correct 149 ms 12836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 197 ms 8284 KB Output is correct
2 Correct 212 ms 16212 KB Output is correct
3 Correct 214 ms 15704 KB Output is correct
4 Correct 200 ms 18000 KB Output is correct
5 Correct 188 ms 15180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 213 ms 8284 KB Output is correct
2 Correct 287 ms 15180 KB Output is correct
3 Correct 187 ms 14676 KB Output is correct
4 Correct 192 ms 18256 KB Output is correct
5 Correct 199 ms 15956 KB Output is correct