Submission #482369

# Submission time Handle Problem Language Result Execution time Memory
482369 2021-10-24T07:43:09 Z Berted Balloons (CEOI11_bal) C++14
100 / 100
237 ms 8652 KB
#include <iostream>
#include <stack>
#include <iomanip>
#include <vector>
#define ld long double
#define pdd pair<ld, ld>
#define fst first
#define snd second

using namespace std;

int N;
vector<pdd> S;

int main()
{
    ios :: sync_with_stdio(0); cin.tie(0);
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        ld X, R; cin >> X >> R;
        while (S.size())
        {
            R = min(R, (X - S.back().fst) * (X - S.back().fst) / (4 * S.back().snd));
            if (R > S.back().snd) {S.pop_back();}
            else {break;}
        }
        S.push_back({X, R});
        cout << fixed << setprecision(3) << R << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 4 ms 332 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 28 ms 436 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 56 ms 1212 KB 50000 numbers
2 Correct 55 ms 2460 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 151 ms 1536 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 126 ms 1716 KB 115362 numbers
2 Correct 124 ms 5456 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 188 ms 1988 KB 154271 numbers
2 Correct 207 ms 8652 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 210 ms 1992 KB 200000 numbers
2 Correct 237 ms 8640 KB 199945 numbers