Submission #941482

#TimeUsernameProblemLanguageResultExecution timeMemory
941482quan606303Balloons (CEOI11_bal)C++14
30 / 100
119 ms8056 KiB
///0-0 : what is your motivation, quan606303? ///quan606303 : Hutao /*idea : */ #include <bits/stdc++.h> #define int long long #define ll long long #define INTMAX INT_MAX #define INTMIN INT_MIN #define LONGMAX LLONG_MAX #define LONGMIN LLONG_MIN #define fi first #define se second #define memfull(a,b) memset(a,b,sizeof(a)); #define endl '\n' #define file(a) freopen(a".inp","r",stdin); freopen(a".out","w",stdout); using namespace std; const int MOD=1e9+7; const int maxn=200005; pair<int,int> a[maxn]; int n; long double ans[maxn]; long double sqr(long double k) { return k*k; } long double cal(pair<long double,long double> x, long double pos) { return sqr(pos-x.fi)/(4*x.se); } void solve() { stack<pair<long double,long double> > st; //st.push() for (int i=1;i<=n;i++) { long double r=a[i].se; while (st.size()) { long double cnt=cal(st.top(),a[i].fi); r=min(r,cnt); if (cnt>=st.top().se)st.pop(); else break; } ans[i]=r; st.push({a[i].fi,ans[i]}); } for (int i=1;i<=n;i++)cout<<setprecision(3)<<fixed<<ans[i]<<endl; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //file(""); cin>>n; for (int i=1;i<=n;i++)cin>>a[i].fi>>a[i].se; solve(); 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...