Submission #1013109

# Submission time Handle Problem Language Result Execution time Memory
1013109 2024-07-03T07:55:06 Z nrg_studio Balloons (CEOI11_bal) C++17
40 / 100
112 ms 4812 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define FOR(i, a, b, s) for (int i = (a); i < (b); i += s)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define pii pair<ld,ld>
#define mp make_pair
#define f first
#define s second

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n; cin >> n;
	ll x, r;
	stack<pii> s;
	cout << fixed << setprecision(3);
	F0R(i,n) {
		cin >> x >> r;
		ld r1 = r;
		while (s.size()) {
			pii p = s.top(); 
			ld cand = min((ld)(x-p.f)*(x-p.f)/p.s/4,(ld)r);
			if (cand <= r1) {r1 = cand;}
			else {while (s.size()&&s.top().s <= r1) {s.pop();} break;}
			if (cand >= p.s) {s.pop();}
			else {break;}
		} s.push({x,r1});
		cout << r1 << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 2 ms 348 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 856 KB 15963rd numbers differ - expected: '34.6800000000', found: '38.8800000000', error = '4.2000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 1848 KB 26317th numbers differ - expected: '1.1140000000', found: '16.4820000000', error = '15.3680000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 2896 KB 7466th numbers differ - expected: '2.8320000000', found: '3.7070000000', error = '0.8750000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 3412 KB 4908th numbers differ - expected: '3.2090000000', found: '3.8130000000', error = '0.6040000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 4512 KB 78048th numbers differ - expected: '3.7750000000', found: '3.8270000000', error = '0.0520000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 4812 KB 4357th numbers differ - expected: '2.3760000000', found: '4.2280000000', error = '1.8520000000'
2 Halted 0 ms 0 KB -