제출 #1319757

#제출 시각아이디문제언어결과실행 시간메모리
1319757blackscreen1Balloons (CEOI11_bal)C++20
20 / 100
147 ms9952 KiB
#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_multiset;
#define ll long long
#define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define pll pair<ll, ll>
#define INF 1000000000000000
#define MOD1 1000000007
#define MOD2 998244353
#define MOD3 1000000009
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	long double x, y;
	vector<pair<long double, long double>> v;
	cout << fixed << setprecision(3);
	iloop(0, n) {
		cin >> x >> y;
		while (v.size() >= 2) {
			pair<long double, long double> tmp = v.back();
			v.pop_back();
			if (tmp.second*(x - v.back().first)*(x - v.back().first) > v.back().second*(x - tmp.first)*(x - tmp.first)) {
				v.push_back(tmp);
				break;
			}
		}
		if (v.size()) v.push_back({x, min((long double)y, ((x - v.back().first)*(x - v.back().first))/(4*v.back().second))});
		else v.push_back({x, y});
		cout << v.back().second << "\n";
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...