Submission #572237

# Submission time Handle Problem Language Result Execution time Memory
572237 2022-06-04T03:11:57 Z guagua0407 Balloons (CEOI11_bal) C++17
100 / 100
258 ms 5524 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main() {_
	int n;
	cin>>n;
	stack<pair<ld,ld>> s;
	for(int i=0;i<n;i++){
		ld x,r;
		cin>>x>>r;
		while(!s.empty()){
			ld x1=s.top().f;
			ld r1=s.top().s;
			r=min(r,(x-x1)*(x-x1)/((4.0)*r1));
			if(r>=r1) s.pop();
			else break;
		}
		s.push({x,r});
		cout<<fixed<<setprecision(3)<<r<<'\n';
	}
	return 0;
}
//maybe its multiset not set
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 22 ms 380 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 58 ms 1068 KB 50000 numbers
2 Correct 62 ms 1584 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 125 ms 1396 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 135 ms 1664 KB 115362 numbers
2 Correct 132 ms 3476 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 196 ms 1792 KB 154271 numbers
2 Correct 202 ms 5452 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 258 ms 1864 KB 200000 numbers
2 Correct 206 ms 5524 KB 199945 numbers