Submission #1059315

# Submission time Handle Problem Language Result Execution time Memory
1059315 2024-08-14T21:07:08 Z ssitaram Balloons (CEOI11_bal) C++17
100 / 100
103 ms 11860 KB
#include <bits/stdc++.h>
using namespace std;

typedef long double ld;

struct bal {
	ld x, r;
};

ld sq(ld v) { return v * v; }

int main() {
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	cout << fixed << setprecision(3);
	int n; cin >> n;
	vector<bal> ball(n);
	for (bal& b : ball) cin >> b.x >> b.r;
	stack<bal> pre;
	for (bal& b : ball) {
		while (!pre.empty()) {
			b.r = min(b.r, sq(b.x - pre.top().x) / (4 * pre.top().r));
			if (b.r < pre.top().r) break;
			pre.pop();
		}
		pre.push(b);
		cout << b.r << '\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1372 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 35 ms 3464 KB 50000 numbers
2 Correct 29 ms 3288 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 54 ms 5972 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 66 ms 7064 KB 115362 numbers
2 Correct 59 ms 7252 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 83 ms 9128 KB 154271 numbers
2 Correct 95 ms 11860 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 103 ms 11092 KB 200000 numbers
2 Correct 94 ms 11860 KB 199945 numbers