Submission #941660

# Submission time Handle Problem Language Result Execution time Memory
941660 2024-03-09T09:14:09 Z tnknguyen_ Balloons (CEOI11_bal) C++14
0 / 100
2000 ms 2836 KB
#include <bits/stdc++.h>
using namespace std;
#define endl '\n' 
#define pll pair<long long, long long>

const int sz = 1e5 + 5;
pll a[sz];
long double f[sz];

long double dist(long long x, long long y, long long u, long long v){
    x = x - u;
    y = y - v;

    return sqrt(x*x + y*y);
}

long double bs(long double x, long double y, long double p){
    long double l = 0, r = 1e9;
    for(int i=1;i<45;++i){
        long double mid = (l + r) / 2;
        if(dist(x, y, p, mid) >= mid + y){
            l = mid;
        }
        else{
            r = mid;
        }
    }

    return (l + r) / 2;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //freopen("main.inp","r",stdin);
    //freopen("main.out","w",stdout);

    int n;
    cin>>n;

    for(int i=1;i<=n;++i){
        cin >> a[i].first >> a[i].second;    
        f[i] = a[i].second;
        for(int j=i-1;j>=1;--j){
            f[i] = min(f[i], bs(a[j].first, f[j], a[i].first));
        }
        cout << fixed << setprecision(3) << f[i]<<endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB 2nd numbers differ - expected: '4.1670000000', found: '4.2840000000', error = '0.1170000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB 2nd numbers differ - expected: '252735385.4379999936', found: '252735385.4329999983', error = '0.0049999952'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 159 ms 2500 KB 3rd numbers differ - expected: '0.0420000000', found: '0.0840000000', error = '0.0420000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2025 ms 2808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2047 ms 2836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2058 ms 2644 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2062 ms 2640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2062 ms 2832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2013 ms 2828 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2008 ms 2660 KB Time limit exceeded
2 Halted 0 ms 0 KB -