답안 #470633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
470633 2021-09-04T16:09:44 Z zxcvbnm Mobile (BOI12_mobile) C++14
100 / 100
510 ms 31432 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
struct P {
    ll x, y;
};
vector<P> a;
int n, L;
bool ok(double r) {
    double curr = 0;
    for(int i = 0; i < n; i++) {
        if (r * r < a[i].y * a[i].y) continue;
        double sol = sqrt(r * r - a[i].y * a[i].y);
        double left = max((double) 0, a[i].x - sol);
        double right = min((double) L, a[i].x + sol);
        if (left <= curr) {
            curr = max(curr, right);
        }
    }

    return curr >= L;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> L;
    a.resize(n);
    for(auto& i : a) {
        cin >> i.x >> i.y;
    }

    double l = 0, r = 1e9;
    double ans = r;
    for(int rep = 0; rep < 40; rep++) {
        double mid = (l + r) / 2;

        if (ok(mid)) {
            r = mid;
            ans = mid;
        }
        else {
            l = mid;
        }
    }

    cout << fixed << setprecision(6) << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 1484 KB Output is correct
2 Correct 37 ms 1484 KB Output is correct
3 Correct 25 ms 1100 KB Output is correct
4 Correct 35 ms 1484 KB Output is correct
5 Correct 19 ms 1100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1484 KB Output is correct
2 Correct 27 ms 1356 KB Output is correct
3 Correct 31 ms 1484 KB Output is correct
4 Correct 32 ms 1484 KB Output is correct
5 Correct 36 ms 1612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 1612 KB Output is correct
2 Correct 42 ms 1612 KB Output is correct
3 Correct 37 ms 1612 KB Output is correct
4 Correct 38 ms 1868 KB Output is correct
5 Correct 34 ms 1612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 1868 KB Output is correct
2 Correct 48 ms 1868 KB Output is correct
3 Correct 45 ms 1868 KB Output is correct
4 Correct 37 ms 1868 KB Output is correct
5 Correct 37 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 1868 KB Output is correct
2 Correct 48 ms 1868 KB Output is correct
3 Correct 43 ms 1868 KB Output is correct
4 Correct 37 ms 1868 KB Output is correct
5 Correct 39 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 217 ms 8140 KB Output is correct
2 Correct 249 ms 8140 KB Output is correct
3 Correct 241 ms 8140 KB Output is correct
4 Correct 181 ms 8140 KB Output is correct
5 Correct 190 ms 8140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 246 ms 8140 KB Output is correct
2 Correct 292 ms 8140 KB Output is correct
3 Correct 212 ms 8140 KB Output is correct
4 Correct 184 ms 8140 KB Output is correct
5 Correct 183 ms 8140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 260 ms 9676 KB Output is correct
2 Correct 298 ms 9676 KB Output is correct
3 Correct 292 ms 9676 KB Output is correct
4 Correct 258 ms 9676 KB Output is correct
5 Correct 227 ms 9676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 305 ms 9676 KB Output is correct
2 Correct 315 ms 9676 KB Output is correct
3 Correct 256 ms 9676 KB Output is correct
4 Correct 225 ms 9676 KB Output is correct
5 Correct 225 ms 9676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 314 ms 11212 KB Output is correct
2 Correct 347 ms 11212 KB Output is correct
3 Correct 345 ms 11212 KB Output is correct
4 Correct 264 ms 11212 KB Output is correct
5 Correct 264 ms 11212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 371 ms 11212 KB Output is correct
2 Correct 356 ms 11252 KB Output is correct
3 Correct 355 ms 11212 KB Output is correct
4 Correct 264 ms 11212 KB Output is correct
5 Correct 270 ms 11212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 349 ms 12748 KB Output is correct
2 Correct 398 ms 12748 KB Output is correct
3 Correct 384 ms 12748 KB Output is correct
4 Correct 298 ms 12748 KB Output is correct
5 Correct 296 ms 12748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 398 ms 12760 KB Output is correct
2 Correct 414 ms 12748 KB Output is correct
3 Correct 343 ms 12752 KB Output is correct
4 Correct 293 ms 12748 KB Output is correct
5 Correct 292 ms 12748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 451 ms 15964 KB Output is correct
2 Correct 510 ms 31432 KB Output is correct
3 Correct 487 ms 30412 KB Output is correct
4 Correct 376 ms 16804 KB Output is correct
5 Correct 384 ms 29520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 499 ms 15948 KB Output is correct
2 Correct 508 ms 29124 KB Output is correct
3 Correct 485 ms 28236 KB Output is correct
4 Correct 379 ms 16836 KB Output is correct
5 Correct 391 ms 30676 KB Output is correct