답안 #781096

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
781096 2023-07-12T17:42:12 Z uped Mobile (BOI12_mobile) C++14
100 / 100
378 ms 15956 KB
// ~uped
#include<bits/stdc++.h>

using namespace std;

using ll = long long;

void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fastio();
    int n, len;
    cin >> n >> len;
    vector<pair<ll, ll>> v(n);
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        v[i] = {a, b};
    }
    // binary search radius
    double l = 0.0, r = 1e10;
    while (r - l > 1e-3) {
        double radius = (l + r) / 2.0;
        double mx = 0;
        for (int j = 0; j < n; ++j) {
            ll x = v[j].first;
            ll y = v[j].second;
            // a*a+b*b=c*c => c*c-b*b=a*a
            double a = sqrt( radius * radius - y * y);
            // we cover segment from x - a to x + a
            if (x - a <= mx) {
                mx = max(x + a, mx);
            }
        }
        if (mx >= len) {
            r = radius;
        } else {
            l = radius;
        }
    }
    cout <<  setprecision(20) << r;
    return 0;
}
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 372 KB Output is correct
4 Correct 2 ms 340 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 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 388 KB Output is correct
3 Correct 2 ms 396 KB Output is correct
4 Correct 2 ms 404 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 1492 KB Output is correct
2 Correct 19 ms 1492 KB Output is correct
3 Correct 16 ms 1108 KB Output is correct
4 Correct 27 ms 1492 KB Output is correct
5 Correct 13 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1492 KB Output is correct
2 Correct 22 ms 1364 KB Output is correct
3 Correct 25 ms 1492 KB Output is correct
4 Correct 26 ms 1492 KB Output is correct
5 Correct 30 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 1620 KB Output is correct
2 Correct 21 ms 1620 KB Output is correct
3 Correct 21 ms 1620 KB Output is correct
4 Correct 35 ms 1876 KB Output is correct
5 Correct 34 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 1876 KB Output is correct
2 Correct 26 ms 1876 KB Output is correct
3 Correct 24 ms 1876 KB Output is correct
4 Correct 36 ms 1876 KB Output is correct
5 Correct 31 ms 1876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 1876 KB Output is correct
2 Correct 26 ms 1876 KB Output is correct
3 Correct 25 ms 1876 KB Output is correct
4 Correct 36 ms 1876 KB Output is correct
5 Correct 31 ms 1876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 8148 KB Output is correct
2 Correct 130 ms 8148 KB Output is correct
3 Correct 125 ms 8148 KB Output is correct
4 Correct 181 ms 8148 KB Output is correct
5 Correct 153 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 129 ms 8148 KB Output is correct
2 Correct 209 ms 8148 KB Output is correct
3 Correct 126 ms 8148 KB Output is correct
4 Correct 180 ms 8148 KB Output is correct
5 Correct 159 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 9684 KB Output is correct
2 Correct 155 ms 9684 KB Output is correct
3 Correct 146 ms 9684 KB Output is correct
4 Correct 222 ms 9684 KB Output is correct
5 Correct 184 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 161 ms 9684 KB Output is correct
2 Correct 241 ms 9696 KB Output is correct
3 Correct 146 ms 9684 KB Output is correct
4 Correct 207 ms 9684 KB Output is correct
5 Correct 211 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 158 ms 11220 KB Output is correct
2 Correct 176 ms 11220 KB Output is correct
3 Correct 172 ms 11220 KB Output is correct
4 Correct 243 ms 11220 KB Output is correct
5 Correct 208 ms 11220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 203 ms 11220 KB Output is correct
2 Correct 260 ms 11220 KB Output is correct
3 Correct 173 ms 11220 KB Output is correct
4 Correct 259 ms 11220 KB Output is correct
5 Correct 221 ms 11220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 176 ms 12756 KB Output is correct
2 Correct 210 ms 12756 KB Output is correct
3 Correct 197 ms 12840 KB Output is correct
4 Correct 295 ms 12776 KB Output is correct
5 Correct 251 ms 12740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 206 ms 12756 KB Output is correct
2 Correct 305 ms 12756 KB Output is correct
3 Correct 196 ms 12756 KB Output is correct
4 Correct 332 ms 12756 KB Output is correct
5 Correct 255 ms 12756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 219 ms 15956 KB Output is correct
2 Correct 248 ms 15956 KB Output is correct
3 Correct 268 ms 15956 KB Output is correct
4 Correct 350 ms 15956 KB Output is correct
5 Correct 316 ms 15956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 251 ms 15956 KB Output is correct
2 Correct 378 ms 15956 KB Output is correct
3 Correct 244 ms 15956 KB Output is correct
4 Correct 345 ms 15956 KB Output is correct
5 Correct 317 ms 15956 KB Output is correct