Submission #998485

# Submission time Handle Problem Language Result Execution time Memory
998485 2024-06-14T04:14:25 Z hippo123 Balloons (CEOI11_bal) C++17
10 / 100
399 ms 9296 KB
#include <bits/stdc++.h>
using namespace std;

#define pr pair<double, int>
#define ll long long
#define pb push_back
#define f first
#define s second


int main(){
	int n; cin>>n;
	vector<double> x(n), r(n);
	for (int i=0;i<n; i++) cin>>x[i]>>r[i];
	
	stack<pr> st;
	double ans[n];
	for (int i=0; i<n; i++){
		double br=r[i]; 	
		while(!st.empty() ){
			br=min(br, (x[i]-x[st.top().s])*(x[i]-x[st.top().s])/(4*r[st.top().s]));	
			if(br>st.top().f){
				st.pop();
			}
			else{
				break;
			}	
		}
		st.push({br, i});		
		ans[i]=br; 
	}
	cout << fixed << setprecision(3);
	for (int i=0; i<n; i++) cout<<ans[i]<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB 5th numbers differ - expected: '17.1630000000', found: '4.3710000000', error = '12.7920000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 432 KB 5th numbers differ - expected: '0.1170000000', found: '0.0830000000', error = '0.0340000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 344 KB 3rd numbers differ - expected: '121.0000000000', found: '120.0180000000', error = '0.9820000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1204 KB 3rd numbers differ - expected: '211.0000000000', found: '210.0110000000', error = '0.9890000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 2644 KB 3rd numbers differ - expected: '15396.0000000000', found: '9489.3930000000', error = '5906.6070000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 207 ms 5064 KB 3rd numbers differ - expected: '7936.0000000000', found: '6084.6240000000', error = '1851.3760000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 233 ms 5832 KB 6th numbers differ - expected: '5053.0000000000', found: '5052.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 342 ms 7508 KB 3rd numbers differ - expected: '1872.0000000000', found: '1871.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 399 ms 9296 KB 3rd numbers differ - expected: '2960.0000000000', found: '2959.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -