Submission #647703

#TimeUsernameProblemLanguageResultExecution timeMemory
647703IliyaBalloons (CEOI11_bal)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

double radius(pair<double, double> a, double x){
	return (a.first - x) * (a.first - x) / (4 * a.second);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	
	int n;
	cin >> n;
	vector<double> ans(n);
	stack<pair<double, double>> st;
	for(int i = 0; i < n; i++){
		double x, r;
		cin >> x >> r;
		while(!st.empty()){
			double tmp = radius(st.top(), x);
			r = min(r, tmp);
			if(r >= last) st.pop();
			else break;
		}
		ans[i] = r;
		st.push({x, r});
	}
	cout << fixed << setpercision(5);
	for(auto i : ans)
		cout << i << '\n';
	return 0;
}

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:23:12: error: 'last' was not declared in this scope; did you mean 'st'?
   23 |    if(r >= last) st.pop();
      |            ^~~~
      |            st
bal.cpp:29:19: error: 'setpercision' was not declared in this scope
   29 |  cout << fixed << setpercision(5);
      |                   ^~~~~~~~~~~~