Submission #722670

# Submission time Handle Problem Language Result Execution time Memory
722670 2023-04-12T14:37:39 Z Macker Balloons (CEOI11_bal) C++14
100 / 100
207 ms 5452 KB
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <math.h>
#include <tuple>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <climits>
#include <fstream>
#include <cassert>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()

ld getR(ll dist, ld r) {
	return ((ld)(dist * dist)) / (4 * r);
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
    ll n; cin >> n;
	stack<pair<ll, ld>> s;
	cout << fixed << setprecision(3);
	for (ll i = 0; i < n; i++) {
		ll pos; ld r; cin >> pos >> r;
		while(!s.empty()) {
			ll d = pos - s.top().first;
			r = min(getR(d, s.top().second), r);
			if (r < s.top().second) break;
			else s.pop(); 
		}
		cout << r << "\n";
		s.push({ pos, r });
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 20 ms 456 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 49 ms 992 KB 50000 numbers
2 Correct 46 ms 1604 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 99 ms 1380 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 116 ms 1600 KB 115362 numbers
2 Correct 111 ms 3360 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 155 ms 1868 KB 154271 numbers
2 Correct 207 ms 5428 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 194 ms 1912 KB 200000 numbers
2 Correct 177 ms 5452 KB 199945 numbers