답안 #949750

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949750 2024-03-19T15:49:50 Z Kavelmydex Mobile (BOI12_mobile) C++17
100 / 100
419 ms 61800 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 endl "\n"
#define sp ' '
#define pb push_back
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()
 
const int N = 4e5+10, OO = 1e18, mod = 1e9, mx = 2e6;
void tr(int a, int b){cout << a << sp << b << endl;}
void cmx(double &a, double b){a = max(a,b);}
void cmn(double &a, double b){a = min(a,b);}

int n,l; 
bool in(int x){return 0<=x && x<=l;}
vector <pi> inp,v;
bool ok(double m){
    double mx = 0;
    For(i,n){
        auto [x,y] = v[i];
        if(y > m) continue;
        double d = sqrt(m * m - y * y);
        if(x-d <= mx && mx < x+d){
            mx = x+d;
        }
    }
    return mx >= l;   
}
int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> l;
    For(i,n){
        int x,y; cin >> x >> y;
        y = abs(y);
        inp.pb({x,y});
    }   
    For(i,n){
        int j = i, y = inp[i].s;
        while(j < n && inp[i].f == inp[j].f) y = min(y,inp[j].s), j++;
        v.pb({inp[i].f, y});
        i = j-1;
    }   inp.clear();
    n = v.sz;
    double l = 0, r = 1e10;
    For(i,60){
        double m = (l+r)/2;
        if(ok(m)) r = m;
        else l = m;
    }
    cout << fixed << setprecision(4) << r << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 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 856 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 544 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 3 ms 604 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 2 ms 728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 2 ms 820 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 6612 KB Output is correct
2 Correct 22 ms 4564 KB Output is correct
3 Correct 16 ms 3288 KB Output is correct
4 Correct 21 ms 5844 KB Output is correct
5 Correct 6 ms 2012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 2520 KB Output is correct
2 Correct 15 ms 3796 KB Output is correct
3 Correct 21 ms 5844 KB Output is correct
4 Correct 23 ms 6036 KB Output is correct
5 Correct 24 ms 6356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 4820 KB Output is correct
2 Correct 25 ms 3540 KB Output is correct
3 Correct 25 ms 5588 KB Output is correct
4 Correct 28 ms 6864 KB Output is correct
5 Correct 15 ms 3540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 3540 KB Output is correct
2 Correct 23 ms 5000 KB Output is correct
3 Correct 14 ms 3540 KB Output is correct
4 Correct 31 ms 6868 KB Output is correct
5 Correct 25 ms 6352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 5076 KB Output is correct
2 Correct 22 ms 5060 KB Output is correct
3 Correct 15 ms 3544 KB Output is correct
4 Correct 29 ms 6952 KB Output is correct
5 Correct 25 ms 6352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 177 ms 21940 KB Output is correct
2 Correct 70 ms 8908 KB Output is correct
3 Correct 73 ms 12992 KB Output is correct
4 Correct 130 ms 31156 KB Output is correct
5 Correct 117 ms 27696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 9924 KB Output is correct
2 Correct 255 ms 27064 KB Output is correct
3 Correct 77 ms 17532 KB Output is correct
4 Correct 132 ms 31156 KB Output is correct
5 Correct 121 ms 28852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 194 ms 35624 KB Output is correct
2 Correct 95 ms 17588 KB Output is correct
3 Correct 85 ms 25328 KB Output is correct
4 Correct 175 ms 48552 KB Output is correct
5 Correct 134 ms 33344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 18100 KB Output is correct
2 Correct 297 ms 43772 KB Output is correct
3 Correct 87 ms 24756 KB Output is correct
4 Correct 211 ms 48752 KB Output is correct
5 Correct 171 ms 45468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 232 ms 37264 KB Output is correct
2 Correct 102 ms 18780 KB Output is correct
3 Correct 99 ms 25416 KB Output is correct
4 Correct 227 ms 51764 KB Output is correct
5 Correct 137 ms 35556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 18164 KB Output is correct
2 Correct 309 ms 48056 KB Output is correct
3 Correct 121 ms 24504 KB Output is correct
4 Correct 186 ms 50092 KB Output is correct
5 Correct 177 ms 47036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 251 ms 38700 KB Output is correct
2 Correct 110 ms 17848 KB Output is correct
3 Correct 124 ms 26324 KB Output is correct
4 Correct 214 ms 56272 KB Output is correct
5 Correct 192 ms 40364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 17596 KB Output is correct
2 Correct 367 ms 51676 KB Output is correct
3 Correct 117 ms 26820 KB Output is correct
4 Correct 245 ms 55980 KB Output is correct
5 Correct 194 ms 50856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 308 ms 40768 KB Output is correct
2 Correct 139 ms 17080 KB Output is correct
3 Correct 133 ms 31504 KB Output is correct
4 Correct 280 ms 61800 KB Output is correct
5 Correct 192 ms 45376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 17076 KB Output is correct
2 Correct 419 ms 54188 KB Output is correct
3 Correct 145 ms 36112 KB Output is correct
4 Correct 286 ms 60072 KB Output is correct
5 Correct 257 ms 57516 KB Output is correct