Submission #401564

# Submission time Handle Problem Language Result Execution time Memory
401564 2021-05-10T13:32:46 Z benk Balloons (CEOI11_bal) C++14
10 / 100
193 ms 4840 KB
#include "bits/stdc++.h"
using namespace std;

#define all(x)      x.begin(), x.end()
#define pb          push_back
#define sz(x)       (int)(x.size())
#define ll          long long
#define fi          first
#define se          second
#define lbd         lower_bound
#define ubd         upper_bound

const int MOD = 1e9 + 7;
const double eps = 1e-10;
const long long INF = 1e18;
const int N = 2e5 + 10;


void solve() {
	int n;
	cin >> n;
	vector<int> x(n), r(n);
	for (int i = 0; i < n; i++) cin >> x[i] >> r[i];

	stack<pair<int, double>> s;
	for (int i = 0; i < n; i++) {
		ll tmp;
		while (!s.empty()) {
			tmp = 1LL * (x[i] - s.top().fi) * (x[i] - s.top().fi);
			double r1 = min(1.0 * r[i], tmp / (4 * s.top().se));
			if (r1 >= s.top().se) s.pop();
			else break;
		}

		double ans;
		if (s.empty()) ans = r[i];
		else ans = min(1.0 * r[i], tmp / (4 * s.top().se));
		cout << fixed << setprecision(10) << ans << '\n';
		s.push({x[i], ans});
	}
}

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

	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB 79th numbers differ - expected: '36.0070000000', found: '2766.0000000000', error = '2729.9930000000'
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 648 KB 137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000'
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 1440 KB 250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 2548 KB 162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 3032 KB 510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 156 ms 3912 KB 161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 193 ms 4840 KB 248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000'
2 Halted 0 ms 0 KB -