Submission #838830

# Submission time Handle Problem Language Result Execution time Memory
838830 2023-08-27T20:17:02 Z a5a7 Mobile (BOI12_mobile) C++14
8 / 100
1000 ms 62980 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; long double l;
    cin >> n >> l;
    long double x[n];
    long double y[n];
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    long double left = 0;
    long double right = l;
    while ((right-left) > (0.0005)){
        long double mid = (left+right)/2;
        pair<long double, long double> ranges[n];
        for (int i = 0; i < n; i++){
            long double sqr = sqrt(max(mid*mid-y[i]*y[i], (long double) 0));
            ranges[i].first = x[i]-sqr;
            ranges[i].second = x[i]+sqr;
        }
        sort(ranges, ranges+n);
        long double bound = 0;
        for (int i = 0; i < n; i++){
            if (ranges[i].first <= bound){
                bound = max(bound, ranges[i].second);
            }
        }
        if (bound >= l){
            right = mid;
        }else{
            left = mid;
        }
    }
    cout << left << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB Output is correct
2 Correct 5 ms 500 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Incorrect 6 ms 500 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 596 KB Output is correct
2 Incorrect 12 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 720 KB Output is correct
2 Incorrect 12 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 596 KB Output is correct
2 Incorrect 12 ms 596 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 201 ms 4976 KB Output is correct
2 Incorrect 307 ms 6172 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 193 ms 5192 KB Output is correct
2 Correct 207 ms 5516 KB Output is correct
3 Incorrect 249 ms 6408 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 196 ms 5832 KB Output is correct
2 Incorrect 345 ms 5324 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 363 ms 6560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 281 ms 6556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 31544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 31576 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1022 ms 37796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 37792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1026 ms 44120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 44108 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 50320 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 50316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 62920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 62980 KB Time limit exceeded
2 Halted 0 ms 0 KB -