Submission #211942

# Submission time Handle Problem Language Result Execution time Memory
211942 2020-03-21T19:37:49 Z csamoila Balloons (CEOI11_bal) C++14
10 / 100
821 ms 5376 KB
#include <iostream>
#include <stack>
#include <iomanip>

using namespace std;

int n;
stack < pair <int,double> > s;

double raza_maxima(int x,double r)
{
    while(!s.empty())
    {
        int x1=s.top().first;
        double r1=s.top().second;
        double rnou=(double)(x-x1)*(x-x1)/(double)(4*r1);
        //cout << rnou << '\n';
        //cout << s.size() << 'w';
        if(r<=rnou)
        {
            break;
        }
        r=rnou;
        s.pop();
    }
    s.push({x,r});
    return r;
}

int main()
{
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        int x;
        double r;
        cin >> x >> r;
        cout << fixed << setprecision(3) << raza_maxima(x,r) << '\n';
    }
//    while(!s.empty())
//    {
//        cout << s.top().first << ' ' << s.top().second << '\n';
//        s.pop();
//    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 384 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 920 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
# Verdict Execution time Memory Grader output
1 Incorrect 209 ms 1656 KB 13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 409 ms 3064 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
# Verdict Execution time Memory Grader output
1 Incorrect 487 ms 3424 KB 4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 654 ms 4616 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 821 ms 5376 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -