Submission #708955

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

double eps = 1e-5;
int N, L;
bool not_works(double val)
{
    double curr = 0;
    for(int i = 0; i < N; i++)
    {
        double temp_begin = coords[i].first - pow(val*val - coords[i].second*coords[i].second,0.5);
        double temp_end = coords[i].first + pow(val*val - coords[i].second*coords[i].second,0.5);

        if(temp_begin < curr)
        curr = max(curr, temp_end);
    }
    if(curr >= L)
    return true;
    else
    return false;
}
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(not_works(mid))
        hi = mid;
        else
        lo = mid;
    }
    
    cout << setprecision(6) << lo << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 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 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 9 ms 340 KB Output is correct
3 Correct 7 ms 340 KB Output is correct
4 Incorrect 9 ms 356 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 376 KB Output is correct
2 Incorrect 14 ms 416 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 340 KB Output is correct
2 Incorrect 14 ms 388 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 340 KB Output is correct
2 Incorrect 15 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 216 ms 1132 KB Output is correct
2 Incorrect 209 ms 1980 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 147 ms 1144 KB Output is correct
2 Correct 149 ms 1668 KB Output is correct
3 Incorrect 208 ms 1944 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 233 ms 1240 KB Output is correct
2 Incorrect 221 ms 2088 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 312 ms 1584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 279 ms 1328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 4428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 4588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 5528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 5600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 6144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 6348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 7092 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 7020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 8696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 8652 KB Time limit exceeded
2 Halted 0 ms 0 KB -