Submission #928948

#TimeUsernameProblemLanguageResultExecution timeMemory
928948doducanhBalloons (CEOI11_bal)C++14
100 / 100
250 ms7772 KiB
#include <bits/stdc++.h> using namespace std; #define x first #define r second pair<int,int>a[200005]; double ans[200005]; int n; double cal(pair<double,double>a,double bx) { return double((a.x-bx)*(a.x-bx))/(4*a.r); } main() { cin>>n; stack<pair<double,double>>s; for(int i=1;i<=n;i++){ double x,r; cin>>x>>r; double maxr=r; while(s.size()){ double last=cal(s.top(),x); maxr=min(maxr,last); if(maxr>=s.top().r){ s.pop(); continue; } else break; } s.push({x,maxr}); ans[i]=maxr; } for(int i=1;i<=n;i++)cout<<fixed<<setprecision(3)<<ans[i]<<"\n"; return 0; }

Compilation message (stderr)

bal.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main()
      | ^~~~
#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...