Submission #872106

# Submission time Handle Problem Language Result Execution time Memory
872106 2023-11-12T10:16:03 Z 12345678 Balloons (CEOI11_bal) C++17
10 / 100
112 ms 9956 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=2e5+5;
long long n, x[nx], mx[nx];
double dp[nx];
multiset<pair<double, int>> ms;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++) cin>>x[i]>>mx[i];
    for (int i=1; i<=n; i++)
    {
        if (ms.empty()) dp[i]=mx[i], ms.insert({DBL_MAX, i});
        else
        {
            auto itr=ms.lower_bound({x[i], 0});
            dp[i]=min(double(mx[i]), ((x[i]-x[itr->second])*(x[i]-x[itr->second]))/(4*dp[itr->second]));
            while (dp[ms.begin()->second]<=dp[i]&&!ms.empty()) ms.erase(ms.begin());
            if (ms.empty()) ms.insert({DBL_MAX, i});
            else
            {
                int l=ms.begin()->second;
                double a=dp[i]-dp[l], b=-2*(dp[l]*x[i]-dp[i]*x[l]), c=dp[l]*x[i]*x[i]-dp[i]*x[l]*x[l];
                double tmp=(-a+sqrt(b*b-4*a*c))/2*a;
                ms.insert({tmp, i});
            }            
        }
    }
    for (int i=1; i<=n; i++) printf("%.3f\n", dp[i]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4440 KB 7th numbers differ - expected: '11.4400000000', found: '81.0000000000', error = '69.5600000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4448 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB 13th numbers differ - expected: '2.3960000000', found: '6.2550000000', error = '3.8590000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4444 KB 3rd numbers differ - expected: '121.0000000000', found: '123.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 4956 KB 3rd numbers differ - expected: '211.0000000000', found: '213.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 6736 KB 5th numbers differ - expected: '15395.0000000000', found: '15396.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 7768 KB 3rd numbers differ - expected: '7936.0000000000', found: '10352.0000000000', error = '2416.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 8408 KB 5th numbers differ - expected: '5054.0000000000', found: '5055.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 9680 KB 3rd numbers differ - expected: '1872.0000000000', found: '1874.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 9956 KB 3rd numbers differ - expected: '2960.0000000000', found: '2962.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -