Submission #314199

#TimeUsernameProblemLanguageResultExecution timeMemory
314199fsstamxBalloons (CEOI11_bal)C++17
100 / 100
774 ms6712 KiB
#include <bits/stdc++.h>

using namespace std;

stack< pair<long double, long double> > st;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0),
	 cout.tie(0);
    cout<< fixed << setprecision(10);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
	{
		long double x, r;
		cin>> x >> r;
    	while(!st.empty())
		{
			long double d = st.top().first - x;
            r = min(r, d * d / 4 / st.top().second);
            if (r > st.top().second)
				st.pop();
            else
				break;
        }
        st.push(make_pair(x, r));
        cout << r << endl;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...