Submission #464024

# Submission time Handle Problem Language Result Execution time Memory
464024 2021-08-12T08:59:29 Z dutch Balloons (CEOI11_bal) C++17
100 / 100
165 ms 5132 KB
#include <bits/stdc++.h>
using namespace std;

struct readInt{
	readInt& operator>>(int &I){
		char J = I = 0;
		while(J < 48) J = getchar_unlocked();
		while(J > 47) I = I * 10 + J - 48, J = getchar_unlocked();
		return *this;
	}
#define cin __read__
} __read__;

signed main(){
	int n; cin >> n;
	int x[n], st[n+1], *p = st;
	double y[n];

	cout << fixed << setprecision(4);

	for(int i=0, j; i<n; ++i){
		cin >> x[i] >> j; y[i] = j;
		while(p != st){
			y[i] = min(y[i], pow(x[*p]-x[i], 2)/(4.0*y[*p]));
			if(y[*p] < y[i]) --p;
			else break;
		}
		cout << y[*(++p) = i] << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 15 ms 716 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1476 KB 50000 numbers
2 Correct 29 ms 1312 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 79 ms 2756 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 89 ms 3144 KB 115362 numbers
2 Correct 77 ms 2908 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 122 ms 4184 KB 154271 numbers
2 Correct 131 ms 4740 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 165 ms 5132 KB 200000 numbers
2 Correct 112 ms 4808 KB 199945 numbers