Submission #405156

# Submission time Handle Problem Language Result Execution time Memory
405156 2021-05-15T19:29:10 Z dreezy Balloons (CEOI11_bal) C++17
100 / 100
723 ms 8804 KB
#include <bits/stdc++.h>
using namespace std;
#define ld long double

int main(){
	int n; cin >> n;
	
	cout << fixed<< setprecision(3);
	
	stack<pair<ld, long long>> balloons;

	
	for(int i =0; i< n; i++){
		long long x;
		ld r;
		cin >> x >> r;
		
		
		while(balloons.size()){
			ld r1 = balloons.top().first;
			long long x1 = balloons.top().second;
			
			r = min(r, (x - x1) * (x-x1) / r1 / 4.0);
			
			if( r > r1)
				balloons.pop();
			else
				break;
		}
		cout << r << endl;
		
		balloons.push({r, x});
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 7 ms 204 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 69 ms 420 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 172 ms 936 KB 50000 numbers
2 Correct 176 ms 2316 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 354 ms 1404 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 409 ms 1720 KB 115362 numbers
2 Correct 425 ms 5356 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 543 ms 1888 KB 154271 numbers
2 Correct 710 ms 8804 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 674 ms 1860 KB 200000 numbers
2 Correct 723 ms 8724 KB 199945 numbers