Submission #872704

#TimeUsernameProblemLanguageResultExecution timeMemory
8727048pete8Balloons (CEOI11_bal)C++14
10 / 100
137 ms14100 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include<bitset> #include <iomanip> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<pii,pii> #define vi vector<int> #define pb push_back //#define p push #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); using namespace std; #define int long long #define double long double const int mxn=1e5,inf=1e18; double cal(int x,int r){return (double)(((x*x)*1.0)/(4*r*1.0));} deque<int>dq; int32_t main(){ fastio int n;cin>>n; vector<pair<int,double>>v(n); vector<double>sz(n,0); for(int i=0;i<n;i++)cin>>v[i].f>>v[i].s; for(int i=0;i<n;i++){ while(dq.size()>1&&cal(v[i].f-v[dq.size()-1].f,sz[dq.size()-1])>cal(v[i].f-v[dq.size()-2].f,sz[dq.size()-2]))dq.pop_back(); sz[i]=min(v[i].s,cal(v[i].f-v[dq.size()-1].f,sz[dq.size()-1])); while(!dq.empty()&&(sz[i]>sz[dq.back()]))dq.pop_back(); dq.push_back(i); } cout<<setprecision(3)<<fixed; for(auto i:sz)cout<<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...