Submission #464026

# Submission time Handle Problem Language Result Execution time Memory
464026 2021-08-12T09:05:10 Z dutch Balloons (CEOI11_bal) C++17
100 / 100
147 ms 4356 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef _WIN32
#define getchar _getchar_nolock
#else
#define getchar getchar_unlocked
#endif

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

const int LIM = 2e5;

int n, x[LIM], st[LIM+1], *p = st;
double y[LIM];

signed main(){
	cin >> 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], (double(x[*p] - x[i]) * double(x[*p] - x[i])) / (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 1 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 38 ms 1348 KB 50000 numbers
2 Correct 31 ms 1324 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 77 ms 2336 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 102 ms 2800 KB 115362 numbers
2 Correct 73 ms 2724 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 119 ms 3604 KB 154271 numbers
2 Correct 116 ms 4300 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 147 ms 4344 KB 200000 numbers
2 Correct 113 ms 4356 KB 199945 numbers