Submission #314199

# Submission time Handle Problem Language Result Execution time Memory
314199 2020-10-19T03:57:43 Z fsstamx Balloons (CEOI11_bal) C++17
100 / 100
774 ms 6712 KB
#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 time Memory Grader output
1 Correct 0 ms 384 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 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 8 ms 384 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 83 ms 900 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 197 ms 1716 KB 50000 numbers
2 Correct 184 ms 2044 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 398 ms 2552 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 450 ms 3176 KB 115362 numbers
2 Correct 447 ms 4216 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 607 ms 3448 KB 154271 numbers
2 Correct 746 ms 6712 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 774 ms 3888 KB 200000 numbers
2 Correct 744 ms 6524 KB 199945 numbers