Submission #546866

# Submission time Handle Problem Language Result Execution time Memory
546866 2022-04-08T17:16:15 Z blue Balloons (CEOI11_bal) C++17
100 / 100
247 ms 4908 KB
#include <iostream>
#include <vector>
using namespace std;

using dd = double;
using vdd = vector<dd>;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;

	vdd res(1+n);

	vdd x, r;

	cout << fixed;
	cout.precision(10);

	for(int i = 1; i <= n; i++)
	{
		dd X, R;
		cin >> X >> R;

		while(!r.empty())
		{
			R = min(R, (X - x.back())*(X - x.back())/(4.0 * r.back()));

			if(R >= r.back())
			{
				r.pop_back();
				x.pop_back();
			}
			else break;
		}

		r.push_back(R);
		x.push_back(X);

		cout << R << ' ';
	}
	cout << '\n';
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 24 ms 724 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 73 ms 1764 KB 50000 numbers
2 Correct 71 ms 1324 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 131 ms 2848 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 154 ms 3312 KB 115362 numbers
2 Correct 154 ms 2856 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 205 ms 4084 KB 154271 numbers
2 Correct 245 ms 4452 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 247 ms 4908 KB 200000 numbers
2 Correct 219 ms 4544 KB 199945 numbers