답안 #399541

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
399541 2021-05-06T02:57:58 Z Trunkty Balloons (CEOI11_bal) C++14
100 / 100
739 ms 5476 KB
#include <iostream>
#include <stack>
#include <utility>
#include <iomanip>
using namespace std;
int n;
stack<pair<double,double>> stk;

int main(){
	cin >> n;
	cout << fixed << setprecision(3);
	for(int i=1;i<=n;i++){
		double x,r;
		cin >> x >> r;
		while(stk.size()>0){
			double x2=stk.top().first,r2=stk.top().second;
			r = min(r,(x2-x)*(x2-x)/4/r2);
			if(r<r2){
				break;
			}
			else{
				stk.pop();
			}
		}
		stk.push({x,r});
		cout << r << "\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB 2 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 204 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 340 KB 2000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 588 KB 20000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 1508 KB 50000 numbers
2 Correct 192 ms 1604 KB 49912 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 374 ms 2704 KB 100000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 428 ms 3132 KB 115362 numbers
2 Correct 444 ms 3384 KB 119971 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 582 ms 3960 KB 154271 numbers
2 Correct 739 ms 5440 KB 200000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 709 ms 4524 KB 200000 numbers
2 Correct 737 ms 5476 KB 199945 numbers