Submission #772104

# Submission time Handle Problem Language Result Execution time Memory
772104 2023-07-03T16:05:49 Z NK_ Balloons (CEOI11_bal) C++17
10 / 100
139 ms 7352 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>

using namespace std;

#define nl '\n'

using ld = long double;

const ld eps = 1e-9;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	cout << fixed << setprecision(10);
	int N; cin >> N;

	vector<pair<int, ld>> A;

	for(int i = 0; i < N; i++) {
		int x, r; cin >> x >> r;

		ld ans = r;
		while(size(A)) {
			ld D = (x - A.back().first) * ld(1) * (x - A.back().first);
			ld R = min(ld(r), D / (4 * A.back().second));
			// cout << ans - R << " - " << x << endl;

			if ((ans - R) > eps) {
				ans = R; 
				// cout << ans << endl;
				A.pop_back();
			} else break;
		}

		cout << ans << nl;

		A.push_back({x, ans});
	}

    return 0;
}


# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 1092 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 2268 KB 13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 4216 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 4552 KB 4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 115 ms 5960 KB 1730th numbers differ - expected: '5.6890000000', found: '6.8055555556', error = '1.1165555556'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 139 ms 7352 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -