Submission #831268

# Submission time Handle Problem Language Result Execution time Memory
831268 2023-08-20T03:33:56 Z tranxuanbach Balloons (CEOI11_bal) C++17
20 / 100
210 ms 8912 KB
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define fi first
#define se second
#define For(i, l, r) for (auto i = (l); i < (r); i++)
#define ForE(i, l, r) for (auto i = (l); i <= (r); i++)
#define FordE(i, l, r) for (auto i = (l); i >= (r); i--)
#define Fora(v, a) for (auto v: (a))
#define bend(a) (a).begin(), (a).end()
#define isz(a) ((signed)(a).size())

using ll = long long;
using ld = long double;
using pii = pair <int, int>;
using vi = vector <int>;
using vpii = vector <pii>;
using vvi = vector <vi>;

const int N = 2e5 + 5;

int n;
vector <pair <int, double>> a;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("KEK.inp", "r", stdin);
	// freopen("KEK.out", "w", stdout);
	cout << fixed << setprecision(15);
	cin >> n;
	while (n--){
		int x, max_r;
		cin >> x >> max_r;
		double r = max_r;
		while (not a.empty()){
			auto [tx, tr] = a.back();
			r = min(r, (x - tx) * (x - tx) / (4 * tr));
			if (r < tr){
				break;
			}
			a.pop_back();
		}
		a.emplace_back(x, r);
		cout << r << endl;
	}
}

/*
==================================================+
INPUT                                             |
--------------------------------------------------|

--------------------------------------------------|
==================================================+
OUTPUT                                            |
--------------------------------------------------|

--------------------------------------------------|
==================================================+
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 320 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.9334151241', error = '252735384.5045848787'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB 506th numbers differ - expected: '365.0000000000', found: '-2481854.0646065245', error = '2482219.0646065245'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1160 KB 655th numbers differ - expected: '591.0000000000', found: '-2402336.3030539569', error = '2402927.3030539569'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 2248 KB 4th numbers differ - expected: '15396.0000000000', found: '-8148.5509720554', error = '23544.5509720554'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 4616 KB 7234th numbers differ - expected: '7160.0000000000', found: '-2398141.9988687783', error = '2405301.9988687783'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 5048 KB 4643rd numbers differ - expected: '2427.0000000000', found: '-2355611.7017843765', error = '2358038.7017843765'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 135 ms 6732 KB 1734th numbers differ - expected: '1856.0220000000', found: '-2324667.3863617545', error = '2326523.4083617544'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 210 ms 8912 KB 2723rd numbers differ - expected: '859.0470000000', found: '-2333711.4845473454', error = '2334570.5315473452'
2 Halted 0 ms 0 KB -