Submission #708965

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

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

        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 = 1;
    double hi = 1.5e9;
    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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 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 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Incorrect 2 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 212 KB Output is correct
2 Incorrect 4 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Incorrect 4 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Incorrect 4 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 60 ms 876 KB Output is correct
2 Incorrect 52 ms 888 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 852 KB Output is correct
2 Correct 70 ms 852 KB Output is correct
3 Incorrect 73 ms 924 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1100 KB Output is correct
2 Incorrect 57 ms 932 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 1068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 1076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 268 ms 4200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 357 ms 4204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 321 ms 4996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 439 ms 4988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 376 ms 5776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 510 ms 5768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 421 ms 6612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 632 ms 6552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 512 ms 8116 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 761 ms 8020 KB Output isn't correct
2 Halted 0 ms 0 KB -