Submission #314009

# Submission time Handle Problem Language Result Execution time Memory
314009 2020-10-17T19:24:49 Z Parisa_Razzazi Balloons (CEOI11_bal) C++17
100 / 100
952 ms 6512 KB
#include <iostream>
#include <iomanip>
using namespace std;
#include <vector>
vector <pair<long long,long double>> v;
long double fis,r;
long long x;

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x;
		cin >> r;
		long double fis;
		long double m = r;
		while (v.size() && v[v.size()-1].second <= m){
			long double o = x - v[v.size()-1].first;
			fis = o * o / (4.0 * v[v.size()-1].second);
			m = min(m,fis);
			if (v[v.size()-1].second <= m){
				v.pop_back();
			}
		}
		if (v.empty()){
			printf("%.6Lf\n",m);
			v.push_back(make_pair(x,m));
			continue;
		}
		long double o = x - v[v.size()-1].first;
		fis = o * o / (4.0 * v[v.size()-1].second);
		m = min(m,fis);	
		printf("%.6Lf\n",m);
		v.push_back(make_pair(x,m));
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 87 ms 632 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 228 ms 1648 KB 50000 numbers
2 Correct 235 ms 1912 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 459 ms 1860 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 523 ms 2252 KB 115362 numbers
2 Correct 573 ms 4004 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 710 ms 2648 KB 154271 numbers
2 Correct 952 ms 6512 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 877 ms 2680 KB 200000 numbers
2 Correct 951 ms 6328 KB 199945 numbers