답안 #1031428

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031428 2024-07-22T20:27:18 Z shezitt Mobile (BOI12_mobile) C++14
100 / 100
416 ms 15964 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define int ll
#define vi vector<int>
#define ii pair<int,int>
#define x first
#define y second
#define fore(a, b, c) for(int a=b; a<c; ++a)
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define endl '\n'
#define dbg(x) cerr << #x << ": " << x << endl
#define raya cerr << "================" << endl;

double eps = 1e-4;

signed main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, len;
    cin >> n >> len;

    vector<ii> p(n);
    fore(i, 0, n){
        cin >> p[i].x >> p[i].y;
    }

    double low = 0, high = 1e9+5;

    while((high - low) > eps){
        double mid = low + (high - low) / 2;
        
        double mx = 0;

        fore(i, 0, n){
            // double delta = (2*p[i].x)*(2*p[i].x)-4*(p[i].x*p[i].x+p[i].y*p[i].y-mid*mid);
            // double a = (2*p[i].x - sqrt(delta)) / 2;
            // double b = (2*p[i].x + sqrt(delta)) / 2;

            // simplificando:
            double delta = mid * mid - p[i].y * p[i].y;
            double a = p[i].x - sqrt(delta);
            double b = p[i].x + sqrt(delta);
            
            if(a <= mx){
                mx = max(mx, b);
            }
        }

        if(mx >= len){
            high = mid;
        } else {
            low = mid;
        }

    }

    cout << fixed << setprecision(6) << high;

}
# 결과 실행 시간 메모리 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 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 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 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 4 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 2 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1628 KB Output is correct
2 Correct 18 ms 1628 KB Output is correct
3 Correct 14 ms 1116 KB Output is correct
4 Correct 31 ms 1628 KB Output is correct
5 Correct 14 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 1628 KB Output is correct
2 Correct 25 ms 1372 KB Output is correct
3 Correct 29 ms 1628 KB Output is correct
4 Correct 31 ms 1880 KB Output is correct
5 Correct 35 ms 1628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1628 KB Output is correct
2 Correct 20 ms 1628 KB Output is correct
3 Correct 28 ms 1628 KB Output is correct
4 Correct 43 ms 1884 KB Output is correct
5 Correct 30 ms 1624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1884 KB Output is correct
2 Correct 24 ms 1884 KB Output is correct
3 Correct 26 ms 1880 KB Output is correct
4 Correct 43 ms 1880 KB Output is correct
5 Correct 35 ms 1880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1880 KB Output is correct
2 Correct 27 ms 1884 KB Output is correct
3 Correct 25 ms 1880 KB Output is correct
4 Correct 42 ms 1884 KB Output is correct
5 Correct 35 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 8284 KB Output is correct
2 Correct 124 ms 8284 KB Output is correct
3 Correct 117 ms 8284 KB Output is correct
4 Correct 207 ms 8192 KB Output is correct
5 Correct 176 ms 8284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 8284 KB Output is correct
2 Correct 227 ms 8284 KB Output is correct
3 Correct 125 ms 8280 KB Output is correct
4 Correct 214 ms 8280 KB Output is correct
5 Correct 174 ms 8280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 130 ms 9820 KB Output is correct
2 Correct 145 ms 9820 KB Output is correct
3 Correct 142 ms 9820 KB Output is correct
4 Correct 253 ms 9816 KB Output is correct
5 Correct 235 ms 9816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 151 ms 9820 KB Output is correct
2 Correct 254 ms 9820 KB Output is correct
3 Correct 140 ms 9820 KB Output is correct
4 Correct 245 ms 9820 KB Output is correct
5 Correct 221 ms 9820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 150 ms 11356 KB Output is correct
2 Correct 167 ms 11352 KB Output is correct
3 Correct 158 ms 11352 KB Output is correct
4 Correct 268 ms 11356 KB Output is correct
5 Correct 249 ms 11352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 162 ms 11352 KB Output is correct
2 Correct 294 ms 11352 KB Output is correct
3 Correct 167 ms 11352 KB Output is correct
4 Correct 289 ms 11352 KB Output is correct
5 Correct 234 ms 11352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 12892 KB Output is correct
2 Correct 170 ms 12892 KB Output is correct
3 Correct 177 ms 13144 KB Output is correct
4 Correct 338 ms 12892 KB Output is correct
5 Correct 304 ms 12892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 188 ms 12888 KB Output is correct
2 Correct 313 ms 12892 KB Output is correct
3 Correct 244 ms 12892 KB Output is correct
4 Correct 308 ms 12892 KB Output is correct
5 Correct 304 ms 12888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 209 ms 15964 KB Output is correct
2 Correct 240 ms 15964 KB Output is correct
3 Correct 233 ms 15964 KB Output is correct
4 Correct 386 ms 15960 KB Output is correct
5 Correct 395 ms 15960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 229 ms 15964 KB Output is correct
2 Correct 416 ms 15964 KB Output is correct
3 Correct 263 ms 15960 KB Output is correct
4 Correct 412 ms 15960 KB Output is correct
5 Correct 372 ms 15960 KB Output is correct