Submission #919619

# Submission time Handle Problem Language Result Execution time Memory
919619 2024-02-01T08:59:36 Z buzdi Balloons (CEOI11_bal) C++14
10 / 100
151 ms 18116 KB
//#include <fstream>
#include <iostream>
#include <stack>
#include <queue>
#include <algorithm>
#include <vector>
#include <cassert>
#include <map>
#include <iomanip>
#define ll long long
#include <cmath>

using namespace std;

const int NMAX = 2e5;

struct Point
{
    long double x, y;
    void Read()
    {
        cin >> x >> y;
    }
};

int n;
Point a[NMAX + 1];
long double answer[NMAX + 1];
Point st[NMAX + 1];
int indst;

long double Square(long double x)
{
    return x * x;
}

long double Distance(Point p1, Point p2)
{
    return sqrt(Square(p1.x - p2.x) - Square(p1.y - p2.y));
}

long double Radius(Point p1, Point p2)
{
    return Square(p2.x - p1.x) / (4.0 * p1.y);
}

bool Okay(Point p1, Point p2)
{
    return p1.y + p2.y <= Distance(p1, p2);
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n;
    for(int i = 1; i <= n; i++)
        a[i].Read();

    for(int i = 1; i <= n; i++)
    {
        while(indst > 1 && !Okay({a[i].x, Radius(st[indst], a[i])}, st[indst - 1]) && Radius(st[indst], a[i]) <= a[i].y)
            indst--;
        if(indst > 0 && Radius(st[indst], a[i]) <= a[i].y)
            a[i].y = Radius(st[indst], a[i]);
        st[++indst] = a[i];
    }

    for(int i = 1; i <= n; i++)
        cout << fixed << setprecision(3) << a[i].y << '\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2504 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2392 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 4952 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 7744 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 84 ms 13136 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 13460 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 125 ms 16464 KB 1732nd numbers differ - expected: '2.0480000000', found: '2.8120000000', error = '0.7640000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 18116 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -