Submission #595332

# Submission time Handle Problem Language Result Execution time Memory
595332 2022-07-13T15:41:15 Z amin Balloons (CEOI11_bal) C++14
100 / 100
453 ms 8604 KB
#include <bits/stdc++.h>
#include<string>
using namespace std;


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
long n;
cin>>n;
double a[n],b[n];
stack<long>s;
for(long i=0;i<n;i++)
{
    cin>>a[i]>>b[i];
}
double r=0;
for(long i=0;i<n;i++)
{
    r=b[i];
    while(!s.empty())
    {
        long k=s.top();

        r=min(r,double(double((a[i]-a[k])/double(4)/b[k]))*(a[i]-a[k]));

        if(r<b[k])
        {
            break;
        }
        s.pop();
    }
    s.push(i);
    b[i]=r;

cout << fixed <<
setprecision(3);
    cout<<b[i]<<endl;

}


}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 360 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 49 ms 680 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 116 ms 1536 KB 50000 numbers
2 Correct 127 ms 2308 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 225 ms 2748 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 276 ms 3168 KB 115362 numbers
2 Correct 294 ms 5244 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 357 ms 4116 KB 154271 numbers
2 Correct 428 ms 8604 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 453 ms 4992 KB 200000 numbers
2 Correct 427 ms 8524 KB 199945 numbers