답안 #1026863

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1026863 2024-07-18T12:27:16 Z PooyaDaftarian Mobile (BOI12_mobile) C++17
65 / 100
1000 ms 50772 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

#define all(x) x.begin(), x.end()
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(x) freopen(x ".in", "r", stdin); freopen(x ".out", "w", stdout)
#define endl '\n'
#define pb push_back
#define ms(x, y) memset(x, y, sizeof x)
#define out(x) {cout << x << '\n'; return;}
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define int ll

int n, L;
vector<pair<ld, ld>> a;

bool chk(ld x){
    ld mx = 0;
    for (int i = 0 ; i < n ; i++){
        ld d = sqrt(x*x - a[i].ss*a[i].ss);
        ld x = a[i].ff - d, y = a[i].ff + d;
        if (x <= mx) mx = max(mx, y);
    }
    return (mx < L);
}

int32_t main(){
    fast_io;
    cout << fixed << setprecision(14);
	cin >> n >> L;
    a.assign(n, {0, 0});
    for (int i = 0 ; i < n ; i++){
        ld x, h; cin >> x >> h;
        a[i] = {x, h};
    }
    ld l = 0, r = 1e10, mid;
    for (int i = 0 ; i < 80 ; i++){
        mid = l + (r-l)/2;
        if (chk(mid)) l = mid;
        else r = mid;
    }
    cout << l << endl;
    return 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 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 4 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 604 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Correct 8 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 600 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Correct 12 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Correct 9 ms 604 KB Output is correct
5 Correct 7 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 2652 KB Output is correct
2 Correct 70 ms 2648 KB Output is correct
3 Correct 47 ms 2652 KB Output is correct
4 Correct 162 ms 3924 KB Output is correct
5 Correct 69 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 2908 KB Output is correct
2 Correct 117 ms 2648 KB Output is correct
3 Correct 127 ms 2904 KB Output is correct
4 Correct 135 ms 3932 KB Output is correct
5 Correct 148 ms 4592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 3160 KB Output is correct
2 Correct 56 ms 2908 KB Output is correct
3 Correct 74 ms 3932 KB Output is correct
4 Correct 187 ms 5460 KB Output is correct
5 Correct 132 ms 4144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 3416 KB Output is correct
2 Correct 67 ms 3420 KB Output is correct
3 Correct 89 ms 4444 KB Output is correct
4 Correct 188 ms 5460 KB Output is correct
5 Correct 156 ms 4692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 3416 KB Output is correct
2 Correct 75 ms 3420 KB Output is correct
3 Correct 86 ms 4444 KB Output is correct
4 Correct 172 ms 5460 KB Output is correct
5 Correct 161 ms 4740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 384 ms 15964 KB Output is correct
2 Correct 313 ms 15960 KB Output is correct
3 Correct 328 ms 15960 KB Output is correct
4 Correct 774 ms 15960 KB Output is correct
5 Correct 782 ms 22880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 336 ms 15964 KB Output is correct
2 Correct 755 ms 15964 KB Output is correct
3 Correct 428 ms 21844 KB Output is correct
4 Correct 812 ms 25428 KB Output is correct
5 Correct 772 ms 23380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 383 ms 19032 KB Output is correct
2 Correct 387 ms 19036 KB Output is correct
3 Correct 420 ms 27940 KB Output is correct
4 Correct 972 ms 31060 KB Output is correct
5 Correct 905 ms 27048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 391 ms 19032 KB Output is correct
2 Correct 918 ms 19036 KB Output is correct
3 Correct 537 ms 25940 KB Output is correct
4 Execution timed out 1010 ms 30804 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 477 ms 22364 KB Output is correct
2 Correct 479 ms 22360 KB Output is correct
3 Correct 480 ms 32344 KB Output is correct
4 Execution timed out 1036 ms 35676 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 415 ms 22364 KB Output is correct
2 Correct 966 ms 22360 KB Output is correct
3 Correct 536 ms 30684 KB Output is correct
4 Execution timed out 1047 ms 35556 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 474 ms 25432 KB Output is correct
2 Correct 476 ms 25432 KB Output is correct
3 Correct 469 ms 37064 KB Output is correct
4 Execution timed out 1051 ms 41044 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 533 ms 25436 KB Output is correct
2 Execution timed out 1054 ms 25436 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 660 ms 31580 KB Output is correct
2 Correct 656 ms 31580 KB Output is correct
3 Correct 604 ms 46116 KB Output is correct
4 Execution timed out 1056 ms 50772 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 578 ms 31576 KB Output is correct
2 Execution timed out 1010 ms 31576 KB Time limit exceeded
3 Halted 0 ms 0 KB -