답안 #941593

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941593 2024-03-09T07:50:57 Z Kavelmydex Mobile (BOI12_mobile) C++17
100 / 100
405 ms 28364 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define vi vector<int>
#define rep(i,x,n) for(int i=x; i<n; ++i)
#define For(i,n) rep(i,0,n)
#define pb push_back
#define endl "\n"
#define sp ' '
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()
 
const int N = 3e5+10, OO = 1e18, mod = 1e9+7;
void tr(int a, int b){cout << a << sp << b << endl;}
void cmx(int &a, int b){a = max(a,b);}
void cmn(int &a, int b){a = min(a,b);}
 
vector <pi> v;
int n,L;
bool ok(double m){
    double mn = 2e9, mx = -2e9, z = 0;
    For(i,n){
        auto [x,y] = v[i];
        if(y*y > m*m) continue;
        double d = sqrt(m * m - y * y);
        if(x-d <= z && z <= x+d){
            z = x+d;
        }   
        if(x-d < mn) mn = x-d;
        if(mx < x+d) mx = x+d;    
        if(mn <= 0 && L <= mx && z >= L) return 1;
    }
    return 0;
}
int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> L;
    For(i,n){
        int x,y; cin >> x >> y;
        v.pb({x,y});
    }
    double l = 0, r = 1e10;
    For(i,60){
        double m = (l+r)/2;
        if(ok(m)) r = m;
        else l = m;
    }
    cout << setprecision(20) << r << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 1 ms 348 KB Output is correct
3 Correct 0 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 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 3288 KB Output is correct
2 Correct 18 ms 3160 KB Output is correct
3 Correct 11 ms 2008 KB Output is correct
4 Correct 18 ms 3288 KB Output is correct
5 Correct 9 ms 1932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 3032 KB Output is correct
2 Correct 17 ms 3284 KB Output is correct
3 Correct 20 ms 3836 KB Output is correct
4 Correct 22 ms 3296 KB Output is correct
5 Correct 21 ms 3508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 3028 KB Output is correct
2 Correct 18 ms 3284 KB Output is correct
3 Correct 19 ms 3288 KB Output is correct
4 Correct 25 ms 3724 KB Output is correct
5 Correct 16 ms 3288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3280 KB Output is correct
2 Correct 23 ms 3560 KB Output is correct
3 Correct 20 ms 3288 KB Output is correct
4 Correct 27 ms 3844 KB Output is correct
5 Correct 20 ms 3288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 3188 KB Output is correct
2 Correct 22 ms 3436 KB Output is correct
3 Correct 22 ms 3288 KB Output is correct
4 Correct 26 ms 3796 KB Output is correct
5 Correct 20 ms 3284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 213 ms 11792 KB Output is correct
2 Correct 117 ms 14180 KB Output is correct
3 Correct 113 ms 14044 KB Output is correct
4 Correct 117 ms 15304 KB Output is correct
5 Correct 102 ms 13244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 12724 KB Output is correct
2 Correct 249 ms 13760 KB Output is correct
3 Correct 110 ms 11976 KB Output is correct
4 Correct 115 ms 15352 KB Output is correct
5 Correct 99 ms 13508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 219 ms 20688 KB Output is correct
2 Correct 142 ms 22684 KB Output is correct
3 Correct 123 ms 21692 KB Output is correct
4 Correct 145 ms 23732 KB Output is correct
5 Correct 126 ms 22168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 21628 KB Output is correct
2 Correct 284 ms 22340 KB Output is correct
3 Correct 139 ms 21992 KB Output is correct
4 Correct 143 ms 24560 KB Output is correct
5 Correct 118 ms 22712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 262 ms 20144 KB Output is correct
2 Correct 155 ms 23732 KB Output is correct
3 Correct 152 ms 23456 KB Output is correct
4 Correct 174 ms 25784 KB Output is correct
5 Correct 133 ms 23480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 188 ms 22556 KB Output is correct
2 Correct 298 ms 23012 KB Output is correct
3 Correct 148 ms 22364 KB Output is correct
4 Correct 163 ms 24248 KB Output is correct
5 Correct 138 ms 22968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 310 ms 19768 KB Output is correct
2 Correct 193 ms 24376 KB Output is correct
3 Correct 162 ms 24852 KB Output is correct
4 Correct 187 ms 25780 KB Output is correct
5 Correct 156 ms 24524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 191 ms 21428 KB Output is correct
2 Correct 328 ms 23732 KB Output is correct
3 Correct 163 ms 23744 KB Output is correct
4 Correct 197 ms 26584 KB Output is correct
5 Correct 159 ms 23480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 352 ms 21348 KB Output is correct
2 Correct 214 ms 26508 KB Output is correct
3 Correct 230 ms 26056 KB Output is correct
4 Correct 237 ms 26820 KB Output is correct
5 Correct 199 ms 24476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 235 ms 24496 KB Output is correct
2 Correct 405 ms 25124 KB Output is correct
3 Correct 210 ms 23940 KB Output is correct
4 Correct 255 ms 28364 KB Output is correct
5 Correct 206 ms 26296 KB Output is correct