Submission #919685

# Submission time Handle Problem Language Result Execution time Memory
919685 2024-02-01T12:34:27 Z buzdi Balloons (CEOI11_bal) C++11
100 / 100
1617 ms 10108 KB
//#include <fstream>
#include <iostream>
#include <stack>
#include <queue>
#include <algorithm>
#include <vector>
#include <cassert>
#include <map>
#include <iomanip>
#define ll long long

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 Radius(Point p1, Point p2)
{
    return Square(p2.x - p1.x) / (4.0 * p1.y);
}

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

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= indst; j++)
            a[i].y = min(a[i].y, Radius(st[j], a[i]));
        while (indst > 0 && st[indst].y <= a[i].y)
            indst--;
        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 Correct 1 ms 2396 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2392 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2708 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2516 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 655 ms 7032 KB 50000 numbers
2 Correct 331 ms 4688 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 1046 ms 9808 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 1485 ms 9952 KB 115362 numbers
2 Correct 798 ms 7344 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 1617 ms 10108 KB 154271 numbers
2 Correct 1345 ms 8788 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 682 ms 9292 KB 200000 numbers
2 Correct 1345 ms 9040 KB 199945 numbers