Submission #708952

# Submission time Handle Problem Language Result Execution time Memory
708952 2023-03-12T21:25:28 Z mmaiti Mobile (BOI12_mobile) C++11
0 / 100
1000 ms 8304 KB
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
vector<pii> coords;

double eps = 1e-6;
int N, L;
bool works(double val)
{
    double begin = 0;
    double end = L;

    for(int i = 0; i < N; i++)
    {
        if(val*val - coords[i].second*coords[i].second < 0)
        return false;

        double temp_begin = max((double)0,coords[i].first - pow(val*val - coords[i].second*coords[i].second,0.5));
        double temp_end = min((double)L,coords[i].first + pow(val*val - coords[i].second*coords[i].second,0.5));

        begin = max(temp_begin,begin);
        end = min(end,temp_end);
        
        if(begin>end)
        return false;
    }
    return true;
}
int main()
{
    
    cin >> N >> L;
    coords.resize(N);

    for(int i = 0; i < N; i++)
    {
        cin >> coords[i].first >> coords[i].second;
    }

    double lo = 0;
    double hi = 1e11;
    double mid;

    while(abs(hi-lo) > eps)
    {
        mid = (lo + hi)/2;
        if(works(mid))
        hi = mid;
        else
        lo = mid;
    }
    
    cout << setprecision(8) << lo;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 10 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 276 ms 880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 236 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 258 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 321 ms 1236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 325 ms 1076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 4180 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 4444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 5196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 5196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 5964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 5948 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 6776 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 6680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 8304 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 8272 KB Time limit exceeded
2 Halted 0 ms 0 KB -