Submission #963064

# Submission time Handle Problem Language Result Execution time Memory
963064 2024-04-14T12:47:05 Z alecurse Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 48208 KB
#include <iostream>
#include <vector>
#include <math.h>
#define mp make_pair
using namespace std;
int N, 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-4) {
        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 1 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 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 856 KB Output is correct
2 Incorrect 7 ms 452 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 604 KB Output is correct
2 Incorrect 5 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 600 KB Output is correct
2 Incorrect 5 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 3520 KB Output is correct
2 Incorrect 73 ms 3664 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 66 ms 3624 KB Output is correct
2 Correct 85 ms 3420 KB Output is correct
3 Incorrect 108 ms 4000 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 3668 KB Output is correct
2 Incorrect 79 ms 4016 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 5084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 5076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 401 ms 20164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 523 ms 24144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 497 ms 24448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 628 ms 29060 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 593 ms 28400 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 749 ms 33728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 679 ms 32380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 860 ms 38664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 796 ms 40440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 48208 KB Time limit exceeded
2 Halted 0 ms 0 KB -