Submission #584573

# Submission time Handle Problem Language Result Execution time Memory
584573 2022-06-27T14:52:34 Z israeladewuyi Balloons (CEOI11_bal) C++17
100 / 100
623 ms 6852 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define int ll
#define endl "\n"

int N;

int32_t main(){
	cin>>N;
	stack<pair<long double, long double>>St;

	for(int i = 0; i < N; i++){
		long double pos, radius; cin>>pos>>radius;
		if(i == 0){
			cout<<fixed<<setprecision(10)<<radius<<endl;
			St.push({pos, radius});
		}
		else{
			while(!St.empty()){
				auto cur = St.top();
				long double pp = cur.first;
				long double radd = cur.second;
				radius = min((long double)radius, (long double)((pos - pp) * (pos - pp)) / (long double)(4 * radd));
				if(radius >= radd){
					St.pop();
				}
				else break;
			}
			St.push({pos, radius});
			cout<<fixed<<setprecision(10)<<radius<<endl;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 8 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 62 ms 532 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 160 ms 1340 KB 50000 numbers
2 Correct 151 ms 1904 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 315 ms 2132 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 360 ms 2448 KB 115362 numbers
2 Correct 373 ms 4224 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 471 ms 2872 KB 154271 numbers
2 Correct 598 ms 6852 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 623 ms 3340 KB 200000 numbers
2 Correct 604 ms 6800 KB 199945 numbers