답안 #553427

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
553427 2022-04-25T19:37:39 Z Hona_Nguyen Mobile (BOI12_mobile) C++14
50 / 100
1000 ms 48344 KB
#include<bits/stdc++.h>
#define prob "mobile"
#define x first
#define y second
using namespace std;
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int n,L;
pair<double,double> p[maxn+5];
int main(){
//    freopen(prob".in","r",stdin);
//    freopen(prob".out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> n >> L;
    for(int i=1;i<=n;i++) cin >> p[i].x >> p[i].y;
    auto check = [&](double val) -> int{
        vector<pair<double,double>> G;
        for(int i=1;i<=n;i++){
//            if(val < p[i].y) return 0;
            double tmp = sqrt(val*val-p[i].y*p[i].y);
            double xL = p[i].x - tmp;
            double xR = p[i].x + tmp;
            G.push_back(make_pair(xL,xR));
        }
//        sort(G.begin(),G.end(), [](const pair<double,double> A, const pair<double,double> B){
//             if(A.first == B.first) return A.second < B.second;
//             return A.first < B.first;
//             });
        double curx = 0;
        for(int i=0;i<n;i++){
            if(G[i].x <= curx){
               curx = max(curx, G[i].y);
            }
        }
        if(curx >= (double)(L)) return 1;
        return 0;
    };
    double low = 1, high = (double)(2e9), res = 0;
    for(int i=1;i<=100;i++){
        if(high - low < eps) break;
        double mid = (low + high) / (double)(2);
        if(check(mid)){
            res = mid;
            high = mid;
        }
        else{
            low = mid;
        }
    }
    cout << fixed << setprecision(4);
    cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 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 328 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 484 KB Output is correct
2 Correct 4 ms 500 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 612 KB Output is correct
2 Correct 13 ms 692 KB Output is correct
3 Correct 7 ms 868 KB Output is correct
4 Correct 8 ms 692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 612 KB Output is correct
2 Correct 12 ms 676 KB Output is correct
3 Correct 8 ms 768 KB Output is correct
4 Correct 10 ms 692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 628 KB Output is correct
2 Correct 13 ms 612 KB Output is correct
3 Correct 7 ms 612 KB Output is correct
4 Correct 9 ms 632 KB Output is correct
5 Correct 8 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 145 ms 4816 KB Output is correct
2 Correct 220 ms 5348 KB Output is correct
3 Correct 99 ms 3488 KB Output is correct
4 Correct 144 ms 5196 KB Output is correct
5 Correct 79 ms 3432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 154 ms 4872 KB Output is correct
2 Correct 159 ms 5056 KB Output is correct
3 Correct 157 ms 5400 KB Output is correct
4 Correct 154 ms 5416 KB Output is correct
5 Correct 199 ms 5524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 148 ms 5232 KB Output is correct
2 Correct 236 ms 5084 KB Output is correct
3 Correct 170 ms 5144 KB Output is correct
4 Correct 192 ms 5592 KB Output is correct
5 Correct 153 ms 5632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 329 ms 5600 KB Output is correct
2 Correct 267 ms 5612 KB Output is correct
3 Correct 171 ms 5672 KB Output is correct
4 Correct 208 ms 5612 KB Output is correct
5 Correct 184 ms 6024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 185 ms 5724 KB Output is correct
2 Correct 282 ms 5600 KB Output is correct
3 Correct 164 ms 5588 KB Output is correct
4 Correct 189 ms 5696 KB Output is correct
5 Correct 209 ms 6020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 24268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1100 ms 24272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1090 ms 35668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 35600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1082 ms 38784 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1068 ms 38824 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1097 ms 41944 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1096 ms 41848 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 48344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1097 ms 48156 KB Time limit exceeded
2 Halted 0 ms 0 KB -