Submission #872444

# Submission time Handle Problem Language Result Execution time Memory
872444 2023-11-13T06:18:27 Z sleepntsheep Balloons (CEOI11_bal) C++17
40 / 100
2000 ms 3184 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 i = 1; i < n; ++i)
    {
        f80 l = 0, r = ::r[i], iter = 100;
        for (; iter--;)
        {
            f80 m = (l+r)/2, ok = 1;
            for (int j = 0; ok && j < i; ++j)
            {
                f80 dy = abs(::rr[j] - m);
                f80 dx = x[i] - x[j];
                f80 reco = sqrtl(dy * dy + dx * dx);
                if (reco < ::rr[j] + m) ok = 0;
            }
            if (ok) l = m;
            else r = m;
        }

        rr[i] = r;
    }

    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 2396 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 45 ms 2392 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 710 ms 2392 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Execution timed out 2033 ms 2792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2060 ms 2788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2025 ms 2796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2016 ms 2640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2029 ms 3000 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2048 ms 3184 KB Time limit exceeded
2 Halted 0 ms 0 KB -