Submission #847877

# Submission time Handle Problem Language Result Execution time Memory
847877 2023-09-10T17:25:14 Z gtm7 Balloons (CEOI11_bal) C++17
10 / 100
157 ms 13904 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    cout << fixed << setprecision(3);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<pair<long double, long double>> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].first >> a[i].second;
    }
    stack<pair<long double, long double>> s;
    long double d;
    vector<long double> ans(n);
    for (int i = 0; i < n; i++)
    {
        d = a[i].second;
        while (1)
        {
            if (s.empty())
            {
                s.push({a[i].first, d});
                ans[i] = d;
                break;
            }
            else if (s.top().second > a[i].second)
            {
                d = min(d, (s.top().first - a[i].first) * (s.top().first - a[i].first) / (4 * s.top().second));
                s.push({a[i].first, d});
                ans[i] = d;
                break;
            }
            else
            {
                d = min(d, (s.top().first - a[i].first) * (s.top().first - a[i].first) / (4 * s.top().second));
                s.pop();
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        cout << ans[i] << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 17th numbers differ - expected: '213.0000000000', found: '234.0000000000', error = '21.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB 148th numbers differ - expected: '8.2380000000', found: '26.0000000000', error = '17.7620000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1740 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 3920 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 83 ms 7460 KB 7328th numbers differ - expected: '0.0700000000', found: '1.0000000000', error = '0.9300000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 8348 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 126 ms 11160 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 157 ms 13904 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -