Submission #928945

#TimeUsernameProblemLanguageResultExecution timeMemory
928945doducanhBalloons (CEOI11_bal)C++14
0 / 100
225 ms6208 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({a[i].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...