Submission #1042173

# Submission time Handle Problem Language Result Execution time Memory
1042173 2024-08-02T15:40:34 Z sssamui Balloons (CEOI11_bal) C++17
100 / 100
129 ms 11860 KB
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <iomanip>
using namespace std;
using ld = long double;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin >> n;
	vector<ld> x(n), r(n);
	for (int i = 0; i < n; i++) cin >> x[i] >> r[i];

	stack<int> inds;
	for (int i = 0; i < n; i++)
	{
		bool cont = true;
		while (!inds.empty() && cont)
		{
			r[i] = fmin(r[i], (x[inds.top()] - x[i]) * (x[inds.top()] - x[i]) / (4 * r[inds.top()]));
			if (r[i] >= r[inds.top()]) inds.pop();
			else cont = false;
		}

		inds.push(i);
		cout << fixed << setprecision(3) << r[i] << "\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1492 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 27 ms 2984 KB 50000 numbers
2 Correct 45 ms 3164 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 66 ms 5836 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 71 ms 6624 KB 115362 numbers
2 Correct 64 ms 7252 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 89 ms 8788 KB 154271 numbers
2 Correct 98 ms 11860 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 129 ms 10932 KB 200000 numbers
2 Correct 101 ms 11600 KB 199945 numbers