Submission #442893

#TimeUsernameProblemLanguageResultExecution timeMemory
442893NintsiChkhaidzeBalloons (CEOI11_bal)C++14
100 / 100
244 ms11708 KiB
#include <bits/stdc++.h> #define s second #define f first using namespace std; const int N = 200005; long double a[N],b[N]; stack <pair<long double,long double> > st; int main() { ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); int n; cin>>n; for (int i = 1; i <= n; i++) cin>>a[i]>>b[i]; printf("%.3Lf\n",b[1]); st.push({a[1],b[1]}); for (int i = 2; i <= n; i++){ long double x = a[i],r = b[i]; while(st.size()){ long double R = st.top().s,X = st.top().f; long double y = ((x - X)*(x - X))/(4*R); r = min(r,y); if (r >= R) st.pop(); else break; } st.push({a[i],r}); printf("%.3Lf\n",r); } }
#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...