Submission #872451

# Submission time Handle Problem Language Result Execution time Memory
872451 2023-11-13T06:43:19 Z sleepntsheep Balloons (CEOI11_bal) C++17
20 / 100
352 ms 6484 KB
#include <iostream>
#include <iomanip> 
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>

using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
#define N 200005

int n, x[N], r[N];
f80 rr[N];

int main()
{
    ShinLena;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> x[i] >> r[i];

    rr[0] = r[0];
    for (int st = 0, i = 1; i < n; ++i)
    {
        f80 l = 0, r = ::r[i], iter = 50;
        for (; iter--;)
        {
            f80 m = (l+r)/2, ok = 1;
            for (int j = st; ok && j < i; ++j)
            {
                f80 A = 1L * x[i] * x[i] + 1L * x[j] * x[j] - 2L * x[i] * x[j] - 4L * rr[j] * m;
                if (A < 0) ok = 0;
            }
            if (ok) l = m;
            else r = m;
        }

        rr[i] = r;
        if (rr[i] >= ::rr[i-1]) st = i;
    }

    cout << fixed << setprecision(3);
    for (int i = 0; i < n; ++i)
        cout << rr[i] << '\n';

    return 0;
}


# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB 4th numbers differ - expected: '0.0950000000', found: '3.0000000000', error = '2.9050000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2396 KB 504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 4696 KB 653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 5200 KB 13946th numbers differ - expected: '0.0440000000', found: '2215.6580000000', error = '2215.6140000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 219 ms 5456 KB 7237th numbers differ - expected: '0.0220000000', found: '7.0000000000', error = '6.9780000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 5580 KB 4646th numbers differ - expected: '0.0870000000', found: '8.0000000000', error = '7.9130000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 316 ms 6252 KB 1734th numbers differ - expected: '1856.0220000000', found: '1865.0000000000', error = '8.9780000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 352 ms 6484 KB 2723rd numbers differ - expected: '859.0470000000', found: '862.0000000000', error = '2.9530000000'
2 Halted 0 ms 0 KB -