Submission #963066

# Submission time Handle Problem Language Result Execution time Memory
963066 2024-04-14T12:48:36 Z alecurse Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 31732 KB
#include <iostream>
#include <vector>
#include <math.h>
#define mp make_pair
using namespace std;
int N;
double L;
vector<pair<double,double> > points;
vector<pair<double,double> > segs;
bool test(double r) {
    for(int i=0;i<N;i++) {
        double x = points[i].first, y=points[i].second;
        if(r<y) {
            segs[i].first=-1;
            continue;
        }
        double d = sqrt(r*r-y*y);
        segs[i].first=x-d;
        segs[i].second=x+d;
    }
    double left=0;
    for(int i=0;i<N;i++) {
        if(segs[i].first==-1) {
            continue;
        }
        if(segs[i].first<=left) {
            left=max(left,segs[i].second);
        }
    }
    return left>=L;
}


int main() {
    cin>>N>>L;
    segs.resize(N);
    points.resize(N);
    for(int i=0;i<N;i++) {
        cin>>points[i].first>>points[i].second;
    }
    double a = 0, b=1e9;
    double res=1e9;
    while(abs(a-b)>=1e-5) {
        double k=(a+b)/2;
        if(test(k)) {
            res=min(res,k);
            b=k;
        } else {
            a=k;
        }
    }
    cout<<res;
}
# Verdict Execution time Memory 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 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 516 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Incorrect 5 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 348 KB Output is correct
2 Incorrect 5 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 348 KB Output is correct
2 Incorrect 5 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 75 ms 2652 KB Output is correct
2 Incorrect 85 ms 2820 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2652 KB Output is correct
2 Correct 84 ms 2648 KB Output is correct
3 Incorrect 107 ms 2968 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 72 ms 3176 KB Output is correct
2 Incorrect 77 ms 2908 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 3416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 108 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 392 ms 16084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 497 ms 16084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 476 ms 19204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 586 ms 19208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 557 ms 22336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 718 ms 22364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 632 ms 25476 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 808 ms 25480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 794 ms 31732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1014 ms 31580 KB Time limit exceeded
2 Halted 0 ms 0 KB -