Submission #928945

# Submission time Handle Problem Language Result Execution time Memory
928945 2024-02-17T08:41:07 Z doducanh Balloons (CEOI11_bal) C++14
0 / 100
225 ms 6208 KB
#include <bits/stdc++.h>

using namespace std;
#define x first
#define r second
pair<int,int>a[200005];
double ans[200005];
int n;
double cal(pair<double,double>a,double bx)
{
    return double((a.x-bx)*(a.x-bx))/(4*a.r);
}
main()
{
    cin>>n;
    stack<pair<double,double>>s;
    for(int i=1;i<=n;i++){
        double x,r;
        cin>>x>>r;
        double maxr=r;
        while(s.size()){
            double last=cal(s.top(),x);
            maxr=min(maxr,last);
            if(maxr>=s.top().r){
                s.pop();
                continue;
            }
            else break;
        }
        s.push({a[i].x,maxr});
        ans[i]=maxr;
    }
    for(int i=1;i<=n;i++)cout<<fixed<<setprecision(3)<<ans[i]<<"\n";
    return 0;
}

Compilation message

bal.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 2nd numbers differ - expected: '4.1670000000', found: '7.0000000000', error = '2.8330000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd numbers differ - expected: '0.0010000000', found: '0.0050000000', error = '0.0040000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 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 23 ms 792 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 57 ms 1872 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 118 ms 3404 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 143 ms 4092 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 192 ms 5536 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 225 ms 6208 KB 3rd numbers differ - expected: '2960.0000000000', found: '2962.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -