Submission #483474

#TimeUsernameProblemLanguageResultExecution timeMemory
483474ShinBalloons (CEOI11_bal)C++14
20 / 100
182 ms6840 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define all(x) x.begin(), x.end() using namespace std; const int N = 2e5 + 7; const int MOD = 1e9 + 7; // 998244353; const int INF = 1e9 + 7; const long long INFLL = 1e18 + 7; template <class X, class Y> bool minimize(X &a, Y b) { if (a > b) return a = b, true; return false; } template <class X, class Y> bool maximize(X &a, Y b) { if (a < b) return a = b, true; return false; } #define SQR(x) (x) * (x) int n; pair<int, double> a[N]; void solve(void) { cin >> n; for (int i = 1; i <= n; i ++) { int l, r; cin >> l >> r; a[i] = mp(l, r * 1.0); } stack<pair<int, double>> st; st.push(a[1]); for (int i = 2; i <= n; i ++) { while (!st.empty()) { pair<int, double> pre = st.top(); minimize(a[i].se, SQR(pre.fi - a[i].fi) / (4.0 * pre.se)); if (a[i].se < pre.se) break; st.pop(); } st.push(a[i]); } for (int i = 1; i <= n; i ++) { cout << fixed << setprecision(3) << a[i].se << '\n'; } } int main(void) { cin.tie(0)->sync_with_stdio(0); int test = 1; // cin >> test; while (test --) { solve(); } return 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...