Submission #443116

# Submission time Handle Problem Language Result Execution time Memory
443116 2021-07-09T18:11:37 Z prvocislo Balloons (CEOI11_bal) C++17
10 / 100
257 ms 8124 KB
// aww geometria !! :)
#include <bits/stdc++.h>
typedef long double ld;
using namespace std;

ld maxr(ld x1, ld r1, ld x2)
{
    ld x = r1, z = x2 - x1;
    return (z * z) / (4. * x);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout << fixed << setprecision(3);
    int n;
    cin >> n;
    vector<ld> x(n), r(n);
    vector<int> st;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> r[i];
        while (st.size() > 1 && maxr(x[st.back()], r[st.back()], x[i]) > maxr(x[st[st.size() - 2]], r[st[st.size() - 2]], x[i]))
            st.pop_back();
        while (!st.empty() && r[st.back()] < r[i])
             r[i] = min(r[i], maxr(x[st.back()], r[st.back()], x[i])), st.pop_back();
        if (!st.empty()) r[i] = min(r[i], maxr(x[st.back()], r[st.back()], x[i]));
        st.push_back(i);
    }
    for (int i = 0; i < n; i++) cout << r[i] << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 30th numbers differ - expected: '5.5990000000', found: '14.9870000000', error = '9.3880000000'
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB 148th numbers differ - expected: '8.2380000000', found: '26.0000000000', error = '17.7620000000'
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1100 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 2376 KB 13947th numbers differ - expected: '0.0810000000', found: '465.1340000000', error = '465.0530000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 131 ms 4232 KB 7328th numbers differ - expected: '0.0700000000', found: '1.0000000000', error = '0.9300000000'
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 4908 KB 4658th numbers differ - expected: '0.0220000000', found: '57.9810000000', error = '57.9590000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 208 ms 6408 KB 1730th numbers differ - expected: '5.6890000000', found: '6.8060000000', error = '1.1170000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 257 ms 8124 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -