Submission #708953

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

double eps = 1e-4;
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 = 1e10;
    double mid;

    while(abs(hi-lo) > eps)
    {
        mid = (lo + hi)/2;
        if(works(mid))
        hi = mid;
        else
        lo = mid;
    }
    
    cout << setprecision(5) << lo << "\n";
}
# 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 7 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 208 ms 880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 204 ms 908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 214 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 277 ms 1072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 273 ms 1068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 4180 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 4180 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 4948 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 4948 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 5716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 5716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 6484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 6484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 8020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 8020 KB Time limit exceeded
2 Halted 0 ms 0 KB -