Submission #960495

# Submission time Handle Problem Language Result Execution time Memory
960495 2024-04-10T14:20:55 Z dubabuba Balloons (CEOI11_bal) C++14
10 / 100
221 ms 15184 KB
#include <bits/stdc++.h>
using namespace std;

typedef double d64;
typedef long long i64;
typedef pair<int, int> pii;
#define MP make_pair
#define ss second
#define ff first

const int mxn = 1e6 + 10;
d64 x[mxn], r[mxn], ans[mxn];
int n;

d64 mx(int L, int R) {
	d64 dx = x[R] - x[L];
	return dx * dx / (4.0 * ans[L]);
}

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> x[i] >> r[i];

	ans[1] = r[1];
	vector<int> vec;
	vec.push_back(1);

	for(int i = 2; i <= n; i++) {
		while(vec.size() > 1 && mx(vec.back(), i) <= mx(vec[vec.size() - 1], i))
			vec.pop_back();
		ans[i] = min(mx(vec.back(), i), r[i]);
		vec.push_back(i);
	}

	cout << fixed << setprecision(3);
	for(int i = 1; i <= n; i++)
		cout << ans[i] << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4440 KB 4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4440 KB 7th numbers differ - expected: '0.0010000000', found: '9.0000000000', error = '8.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4440 KB 3rd numbers differ - expected: '121.0000000000', found: '123.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 5040 KB 3rd numbers differ - expected: '211.0000000000', found: '213.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 7760 KB 5th numbers differ - expected: '15395.0000000000', found: '15396.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 116 ms 11088 KB 3rd numbers differ - expected: '7936.0000000000', found: '10352.0000000000', error = '2416.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 11352 KB 5th numbers differ - expected: '5054.0000000000', found: '5055.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 180 ms 14360 KB 3rd numbers differ - expected: '1872.0000000000', found: '1874.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 221 ms 15184 KB 3rd numbers differ - expected: '2960.0000000000', found: '2962.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -