Submission #768936

# Submission time Handle Problem Language Result Execution time Memory
768936 2023-06-28T23:39:33 Z orcslop Mobile (BOI12_mobile) C++17
0 / 100
476 ms 20036 KB
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size() 

const int MAXN = 1e6; 

int n; 
double l; 
pair<double, double> v[MAXN]; 

bool check(double rad){
    vector<pair<double, double>> intervals; 
    double curr = 0; 
    for(int i = 0; i < n; i++){
        double dist = 0; 
        if(0 <= v[i].first && v[i].first <= l){
            dist = v[i].second; 
        }
        else if(v[i].first < 0){
            dist = sqrt(v[i].first * v[i].first + v[i].second + v[i].second); 
        }
        else {
            dist=sqrt((v[i].first-l) * (v[i].first - l) + v[i].second * v[i].second); 
        }
        if(dist < rad){
            pair<double, double> range; 
            range.first = max(v[i].first - sqrt(rad * rad - v[i].second * v[i].second), (double)0);
            range.second = min(v[i].first + sqrt(rad * rad - v[i].second * v[i].second), l); 
            if(range.first <= curr) curr = range.second; 
            else return false; 
        }
    }
    return true; 
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin >> n >> l; 
    for(int i = 0; i < n; i++){
        cin >> v[i].first >> v[i].second; 
    }
    // cout << check(5.55); 
    double low = 0, high = (double) 2e9; 
    while (low + 0.0000001 < high) {
        double mid = low + (high - low) / 2;
        if (check(mid)) high = mid;
        else low = mid;
    }
    cout << setprecision(15) << low << '\n'; 
    return 0; 
}
# 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 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 2048 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 2180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 2252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 2484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 2512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 202 ms 8736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 205 ms 8776 KB Output is correct
2 Incorrect 257 ms 12448 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 243 ms 10344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 253 ms 10300 KB Output is correct
2 Incorrect 294 ms 13924 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 290 ms 11912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 305 ms 11908 KB Output is correct
2 Incorrect 363 ms 15492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 321 ms 13472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 335 ms 13356 KB Output is correct
2 Incorrect 386 ms 16904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 418 ms 16472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 413 ms 15972 KB Output is correct
2 Incorrect 476 ms 20036 KB Output isn't correct
3 Halted 0 ms 0 KB -