Submission #838824

# Submission time Handle Problem Language Result Execution time Memory
838824 2023-08-27T19:57:32 Z a5a7 Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 48076 KB
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define READ(arr, n) for (int i = 0; i < (n); i++) cin >> arr[i];
#define ABS(a) (max((a), -(a)))
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; double l;
    cin >> n >> l;
    double x[n];
    double y[n];
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    double left = 0;
    double right = l;
    while ((right-left) > (0.0001)){
        double mid = (left+right)/2;
        bool coversAll = true;
        pair<double, double> ranges[n];
        for (int i = 0; i < n; i++){
            double sqr = sqrt(max(mid*mid-y[i]*y[i], double(0)));
            ranges[i].first = x[i]-sqr;
            ranges[i].second = x[i]+sqr;
        }
        sort(ranges, ranges+n);
        if (ranges[0].first > 0) coversAll = false;
        if (ranges[n-1].second < l) coversAll = false;
        for (int i = 0; i < (n-1) && coversAll; i++){
            if (ranges[i].second < ranges[i+1].first) coversAll = false;
        }
        if (coversAll){
            right = mid;
        }else{
            left = mid;
        }
    }
    cout << left << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB Output is correct
2 Incorrect 5 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 3532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 71 ms 3668 KB Output is correct
2 Incorrect 164 ms 4024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 4984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 106 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 535 ms 20272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 24140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 671 ms 24204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 28876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 786 ms 28260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 33696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 873 ms 32256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 38408 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 40264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 48076 KB Time limit exceeded
2 Halted 0 ms 0 KB -