답안 #770303

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
770303 2023-07-01T05:15:37 Z lukehsiao Balloons (CEOI11_bal) C++14
100 / 100
116 ms 5400 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 2e5;

int n;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin >> n;
	
	cout << fixed << setprecision(3);

	stack<pair<int, double>> st;
	for (int i=0, x, r; i<n; ++i) {
		cin >> x >> r;
		double mr = r;
		while (!st.empty()) {
			int tx = st.top().first;
			double tr = st.top().second;
			double dx = x - tx;
			mr = min(mr, dx * dx / (4 * tr));
			if (mr >= tr)
				st.pop();
			else
				break;
		}
		st.push({x, mr});
		cout << mr << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB 2 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB 2000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 628 KB 20000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1544 KB 50000 numbers
2 Correct 31 ms 1616 KB 49912 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 2708 KB 100000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 3140 KB 115362 numbers
2 Correct 63 ms 3312 KB 119971 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 4024 KB 154271 numbers
2 Correct 104 ms 5376 KB 200000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 116 ms 4616 KB 200000 numbers
2 Correct 105 ms 5400 KB 199945 numbers