Submission #737090

#TimeUsernameProblemLanguageResultExecution timeMemory
737090studyBalloons (CEOI11_bal)C++17
100 / 100
166 ms10220 KiB
#include <bits/stdc++.h> #define int long long using namespace std; struct Bal{ int x; double max_r; }; const int N = 2e5, inf = 1e18; Bal bals[N]; double calc_rayon(Bal a, Bal b){ double dist = a.x-b.x; return dist*dist/4.0/a.max_r; } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); cout.precision(3); cout << fixed; int n; cin >> n; for (int i=0; i<n; ++i){ cin >> bals[i].x >> bals[i].max_r; } stack<Bal> st; for (int i=0; i<n; ++i){ double crt_ans = bals[i].max_r; while (!st.empty()){ Bal f = st.top(); crt_ans = min(crt_ans,calc_rayon(f,bals[i])); if (crt_ans > f.max_r) st.pop(); else break; } st.push({bals[i].x,crt_ans}); cout << crt_ans << '\n'; } 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...