Submission #815238

#TimeUsernameProblemLanguageResultExecution timeMemory
815238serifefedartarBalloons (CEOI11_bal)C++17
100 / 100
199 ms13148 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); typedef long long ll; #define f first #define s second #define MOD 1000000007 #define LOGN 12 #define MAXN 3000000 typedef long double ld; ld find(ld r1, ll x1, ll x2) { ll d_sq = (x2 - x1) * (x2 - x1); ld ans = (d_sq * 1.0) / (4 * r1); return ans; } int main() { fast int n; cin >> n; vector<pair<ll,ll>> bal(n+1); vector<ld> ans(n+1); for (int i = 1; i <= n; i++) cin >> bal[i].f >> bal[i].s; stack<pair<ll, ld>> st; for (int i = 1; i <= n; i++) { ans[i] = (ld)bal[i].s; while (!st.empty()) { pair<ll, ld> p = st.top(); ld q = find(p.s, p.f, bal[i].f); ans[i] = min(ans[i], q); if (ans[i] >= p.s) st.pop(); else break; } st.push({bal[i].f, ans[i]}); } cout << setprecision(10) << fixed; for (int i = 1; i <= n; i++) cout << ans[i] << "\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...