제출 #401357

#제출 시각아이디문제언어결과실행 시간메모리
401357benkBalloons (CEOI11_bal)C++14
10 / 100
198 ms9072 KiB
#include "bits/stdc++.h"
using namespace std;

#define all(x)      x.begin(), x.end()
#define pb          push_back
#define sz(x)       (int)(x.size())
#define ll          long long
#define fi          first
#define se          second
#define lbd         lower_bound
#define ubd         upper_bound

const int MOD = 1e9 + 7;
const double eps = 1e-10;
const long long INF = 1e18;
const int N = 2e5 + 10;


void solve() {
	int n;
	cin >> n;
	vector<int> x(n), r(n);
	for (int i = 0; i < n; i++) cin >> x[i] >> r[i];

	stack<pair<int, int>> s;
	for (int i = 0; i < n; i++) {
		bool ok = 0;
		ll tmp;
		while (!s.empty()) {
			tmp = 1LL * (x[i] - s.top().fi) * (x[i] - s.top().fi);
			if (tmp / 4LL * s.top().se < r[i]) s.pop();
			else break;
		}
		double ans;
		if (s.empty()) ans = r[i];
		else ans = min(1.0 * r[i], tmp / (4.0 * s.top().se));
		cout << fixed << setprecision(10) << ans << '\n';
		s.push({x[i], r[i]});
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
	}
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

bal.cpp: In function 'void solve()':
bal.cpp:27:8: warning: unused variable 'ok' [-Wunused-variable]
   27 |   bool ok = 0;
      |        ^~
#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...