Submission #892718

# Submission time Handle Problem Language Result Execution time Memory
892718 2023-12-25T18:01:05 Z maxFedorchuk Balloons (CEOI11_bal) C++14
100 / 100
150 ms 5604 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    long long n;
    cin>>n;

    stack < pair < long long , long double > > munbal;

    for(long long i=1;i<=n;i++)
    {
        long long x;
        long double r;

        cin>>x>>r;

        while(!munbal.empty())
        {
            long long munx=munbal.top().first;
            long double munr=munbal.top().second;

            r=min(r,((munx-x)*(munx-x)/(4*munr)));

            if(munr>r)
            {
                break;
            }
            else
            {
                munbal.pop();
            }
        }
        munbal.push({x,r});

        cout<<fixed<<setprecision(3)<<r<<"\n";
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 15 ms 860 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1844 KB 50000 numbers
2 Correct 37 ms 1704 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 77 ms 2824 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 95 ms 3716 KB 115362 numbers
2 Correct 89 ms 3392 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 118 ms 4312 KB 154271 numbers
2 Correct 146 ms 5452 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 147 ms 4688 KB 200000 numbers
2 Correct 150 ms 5604 KB 199945 numbers