Submission #405682

# Submission time Handle Problem Language Result Execution time Memory
405682 2021-05-16T17:34:09 Z huukhang Balloons (CEOI11_bal) C++11
10 / 100
261 ms 6584 KB
/*
						   Khangnh's code

“You can either experience the pain of discipline or the pain of regret. 
						The choice is yours.”
*/

// - Only when necessary :d
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
using namespace std;

#define fileopen(a, b) freopen(((string)a + ".inp").c_str(), "r", stdin); freopen(((string)b + ".out").c_str(), "w", stdout); 

#define ll long long
#define ld long double
#define int long long
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
typedef pair<int, int> pii;

const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const double eps = 1e-9;

int n;
int x[200005];
ld r[200005];
stack<pair<int, ld>> st;

ld square(int x) {
	ld y = x;
	return y*y;
}

ld inflate(int x0, ld r0) {
	while (!st.empty()) {
		pii k = st.top();
		r0 = min(r0, square(k.fi - x0)/(4*k.se));

		if (r0 >= k.se) st.pop();
		else break;
	}
	st.push({x0, r0});

	return r0;
}

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

	cout << fixed << setprecision(3);
	for (int i = 1; i <= n; ++i) cout << inflate(x[i], r[i]) << "\n";
}

signed main() {
	#ifdef LOCAL
		fileopen("input", "output");
		auto start = clock();
	#endif
	#ifndef LOCAL
//		fileopen("LAH", "LAH");
	#endif
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;
//	cin >> t;
	while (t--) solve();
	#ifdef LOCAL
		auto end = clock();
		cout << "\n\nExecution time : " << double(end - start)/CLOCKS_PER_SEC << "[s]";
	#endif
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 8th numbers differ - expected: '8.7410000000', found: '9.0910000000', error = '0.3500000000'
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 13th numbers differ - expected: '2.3960000000', found: '2.4500000000', error = '0.0540000000'
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB 3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000'
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 972 KB 44th numbers differ - expected: '165.0000000000', found: '165.0020000000', error = '0.0020000000'
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 2236 KB 254th numbers differ - expected: '15129.9990000000', found: '15130.0010000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 143 ms 3784 KB 286th numbers differ - expected: '7633.9990000000', found: '7634.0010000000', error = '0.0020000000'
# Verdict Execution time Memory Grader output
1 Incorrect 156 ms 4428 KB 511th numbers differ - expected: '4494.0050000000', found: '4494.0070000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 215 ms 5420 KB 165th numbers differ - expected: '1698.9980000000', found: '1699.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 261 ms 6584 KB 249th numbers differ - expected: '2683.0090000000', found: '2683.0110000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -