Submission #443113

# Submission time Handle Problem Language Result Execution time Memory
443113 2021-07-09T18:00:19 Z prvocislo Balloons (CEOI11_bal) C++17
20 / 100
270 ms 8872 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();
        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 Correct 1 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 17th numbers differ - expected: '213.0000000000', found: '234.0000000000', error = '21.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB 504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000'
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 1288 KB 653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000'
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 2516 KB 14174th numbers differ - expected: '0.7720000000', found: '1.3710000000', error = '0.5990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 134 ms 4796 KB 7447th numbers differ - expected: '0.9750000000', found: '8.0000000000', error = '7.0250000000'
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 5408 KB 4793rd numbers differ - expected: '0.9540000000', found: '10.6220000000', error = '9.6680000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 210 ms 7192 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 270 ms 8872 KB 2735th numbers differ - expected: '1883.4630000000', found: '1899.0000000000', error = '15.5370000000'
2 Halted 0 ms 0 KB -