Submission #1129374

#TimeUsernameProblemLanguageResultExecution timeMemory
1129374yazanshBalloons (CEOI11_bal)C++20
10 / 100
159 ms3532 KiB
/* the author : Luffy-san "yazan sharba" */ #include <bits/stdc++.h> using namespace std; /* ⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠒⠁⠀⠀⠀⠀⠀⠘⢿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠓⠤⠤⠤⠤⠄⠒⠒⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣻⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀ ⠶⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡴⠟⠉⠀⠙⢿⣷⣦⣤⣀⣀⣀⡀⠄ ⠀⠀⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢶⣤⣄⣀⡀⠀⠀⠀⣀⣀⣤⣤⡶⠟⠋⠀⠀⠀⠀⠀⠘⢿⣿⣿⠁⠀⠀⠀⠀ ⠀⠀⠀⠀⢲⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣾⠃⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠻⣿⣶⣶⣿⡿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⡇⠀⠀⠀⠀ ⠳⡄⠀⠀⣸⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣷⣾⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣴⡿⠋⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡇⠀⠀⠀⠀ ⠀⢹⡀⢠⡟⠀⠀⠀⠀⠀⢀⣴⠀⠀⠀⠀⠀⢀⣴⡿⠋⠉⠹⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣷⠀⠀⠀⠀ ⠀⢠⣿⡟⠀⠀⠀⠀⠰⣴⡿⠃⠀⠀⠀⠀⢠⣾⣿⣧⡀⠀⠀⣿⠁⠀⠀⠀⠀⠀⠀⢀⣠⣶⡟⣫⡽⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢾⣧⠀⠀⠀ ⣶⣿⡟⠀⠀⠀⠀⠀⣼⣿⠃⠀⠀⠀⠀⢠⣿⣿⢃⣿⣷⣄⢸⡟⠀⠀⠀⠀⠀⠀⣰⣿⣿⠿⠿⠿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣦⣿⡆⠀⠀ ⠻⣿⠀⠀⠀⠀⠀⣼⣿⣿⠀⠀⠀⠀⣠⣾⣿⠿⠋⠁⠈⣻⣾⣧⠀⠀⠀⠀⢀⣾⣿⡟⠁⣀⠀⠀⠀⠹⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⠿⠛⣿⡀⠀ ⣶⣿⣦⣀⣀⣤⣾⣿⡟⢿⣇⡀⠀⢀⣿⣿⠋⠀⣠⣾⠟⣿⣿⣿⡀⠀⠀⠀⣸⡟⢻⡆⠈⢻⣿⠀⠀⢠⡿⠀⢰⡇⠀⠀⠀⠀⢀⣤⠶⢶⣄⠀⠀⠀⠀⠀⣠⡴⠟⠁⠀⠀⣿⡇⠀ ⣿⠁⠉⠻⣿⣿⣿⡏⠁⠘⢿⣷⣶⣿⡿⠃⠀⠀⣿⣁⣶⣿⣿⣿⣇⡀⠀⣀⣿⣅⠈⠛⠷⠛⠁⠀⢀⣾⠇⢠⡾⠀⠀⠀⣠⡶⠋⠁⠀⠀⠹⣧⠀⢀⣴⠾⠋⠀⠀⢀⣤⣾⣿⡇⠀ ⢿⡇⠀⠀⢻⣿⠇⠀⠀⠀⠈⣿⠟⠻⣇⠀⠀⠀⢿⣏⠻⣿⠏⢉⣿⣿⠿⠿⠿⢿⣦⣀⠀⣀⣠⣴⡿⢋⣴⠟⠁⠀⠀⣴⠟⠀⢠⣤⠀⠀⣰⣿⠿⠋⠁⠀⢀⣠⣴⡿⠟⢉⣿⡇⠀ ⠈⠿⣶⣤⣼⣿⠀⠀⠀⠀⠀⠀⠀⠀⢻⣆⠀⠀⠈⢿⣿⣿⣾⠿⠛⠁⠀⠀⠀⢸⣿⣿⢿⣟⠿⠛⠛⠛⠁⠀⠀⠀⣸⣿⠀⠀⠙⢷⣶⠟⠋⠀⠀⣀⣤⣾⣿⡟⠁⠀⢺⣾⡿⠀⠀ ⠉⠀⠈⠉⠃⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⠛⢻⣎⣿⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣷⣤⣤⣤⣤⣴⣶⣾⣿⡋⠁⠀⢻⡇⠀⠀⣼⡟⠁⠀⠀ ⣦⠀⠀⠀⠀⣿⡀⠀⠀⠀⠀⠀⣶⡀⠀⠀⠀⠙⠛⠶⣤⣄⣀⣀⣠⣤⡴⠾⠛⠁⠀⠈⠉⠙⠀⠀⠀⠀⠀⢠⣿⠟⠉⣿⠋⢹⣿⣏⣴⣿⣷⠞⣻⡟⠀⠀⢸⣷⣠⣼⠏⠀⠀⠀⠀ ⢿⣿⣦⣤⣀⣿⡇⠀⠀⠀⢀⣴⠿⣷⣄⠀⠀⠀⠀⠀⠀⠈⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡟⠀⠀⣿⠀⠘⢿⣭⣛⣛⣛⣴⡿⠁⠀⠀⣸⣿⣿⠃⠀⠀⠀⠀⠀ ⠀⠙⠻⣿⣿⣿⣧⠀⠀⠀⣸⡏⠀⠈⠻⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⣿⠁⠀⠀⠹⣧⡀⠀⠉⠙⠛⠉⠁⠀⠀⣠⡾⠛⠛⣿⠀⠀⠀⠀⣠⡟ ⠀⠀⠀⠀⠙⠿⣿⣷⡀⠀⣿⠁⠀⠀⠀⠈⢿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡟⠀⣿⠀⠀⠀⠀⠈⠛⠶⠶⢤⡶⠶⠶⠿⠛⠁⠀⠀⠀⣿⣷⡶⠞⡩⠛⠀ ⠀⠀⠀⠀⠀⠀⠘⠻⢿⣄⣿⡀⠀⠀⠀⢰⠟⠈⠙⠿⣷⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀⠀⣃⣰⣿⠀⠀⢀⣤⣀⠀⠀⠀⠀⡀⠀⣀⣶⠶⠛⠀⠀⣼⣿⣿⠿⠋⢀⣠⠆ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣧⡀⠀⢀⡟⠀⠀⠀⠀⠈⠙⠻⢷⣦⣄⡀⠀⠀⠀⠀⠀⠀⠙⣷⣄⣴⣿⡿⠋⠀⠀⠀⠈⠙⠛⠛⠒⠲⣿⠛⠉⠁⠀⠀⢀⣾⠋⠉⠀⣀⣴⣿⡟⠃ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⣷⡄⣾⠁⠀⠀⠀⠀⠀⠀⢀⡾⠉⠙⠛⠿⣶⣦⣄⣀⠀⠀⠈⠛⠛⠡⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⠀⠀⠀⠀⣰⣿⣃⣤⣶⠾⠛⠉⠁⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⡾⠀⠀⠀⠀⠀⠀⠈⢹⡟⠻⠷⠶⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣴⠟⠁⠀⠀⢀⣼⣿⣿⠟⠉⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⠿⣶⣄⠀⠀⠀⡼⠁⠀⠀⠀⠀⠀⠀⢀⡾⠁⠀⠀⠀⠀⣸⠋⠉⠈⠉⠉⣿⠉⠀⣠⠞⠁⠀⠀⠀⣀⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠙⠻⣦⣴⡃⠀⠀⠀⠀⠀⠀⢀⡾⠁⠀⠀⠀⠀⢰⡟⠀⠀⠀⠀⣸⢇⣠⠾⠉⠀⠀⠀⢀⣴⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣷⡄⠀⠀⠠⣍⡛⠶⣤⣄⡀⠀⠀⡾⠁⠀⠀⠀⠀⢠⡟⠀⠀⠀⣀⣴⡿⠛⠁⠀⠀⠀⢀⣴⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠄⠒⠉⠁ ⠱⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣦⣀⠀⠀⠉⠒⠤⢍⣛⠳⠾⠷⢤⣤⣤⣤⣤⣾⣤⡴⠶⠟⠋⠁⠀⠀⠀⠀⢀⣴⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀ ⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣷⣶⣤⣤⣀⣤⣄⣀⠀⠐⠒⠒⠂⠤⠤⠤⠄⠐⠀⠀⠀⢀⣀⣠⣴⣾⡿⢋⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠐⠁⠀⠀⠀⠀⠀⠀ ⠀⠀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣯⠉⠛⠿⣿⣷⣍⠙⠻⣿⠿⠿⢿⣿⣷⣶⣿⣷⣶⣶⣶⣶⡶⣾⣿⣿⡿⢿⣿⣿⣶⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣷⠀⠀⠈⠉⠛⠿⣦⣅⠀⠀⠀⠈⠉⠉⠉⠉⣿⣿⣿⣿⡷⠿⠋⠁⢀⣾⣿⡟⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⡆⠀⠀⠀⠀⠀⠈⠙⢿⣦⡀⠀⠀⣀⣀⣤⣾⠿⠛⠁⠀⠀⠀⢠⣾⣷⠏⢸⣿⠃⠀⠀⠀⠀⠀⠀⠀⢰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⡇⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣯⢿⣄⠀⠀⠀⠀⠀⠀⠀⠉⠻⣦⣀⣉⣽⠟⠁⠀⠀⠀⠀⠀⢠⣿⣿⠏⠀⣾⣿⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣦⡙⢿⣶⣤⡄⠀⠀⠀⠀⠀⣀⡙⣓⡀⠀⠀⠀⠀⢀⣴⣴⣿⣿⠋⠀⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ */ #define yon(x) cout<<((x)?"YES\n":"NO\n"); #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define ff first #define ss second #define em emplace #define emp emplace_back #define pb push_back #define rep(i,j,k) for(int i=j;i<=k;i++) #define per(i,j,k) for(int i=k;i>=j;i--) #define forp(x,y,a) for(auto &[x,y]:(a)) #define mkp make_pair typedef long long ll; typedef pair<ll,ll> pll; typedef vector<ll> vl; typedef vector<pll> vpl; typedef vector<vl> vvl; typedef vector<vpl> vvpl; typedef vector<string> vs; typedef vector<set<ll> >vst; typedef deque<ll> dl; const ll inf =1e18+1; const int N=1e6+1; const ll dx[]={1,0,-1,0}; const ll dy[]={0,1,0,-1,0}; const ll mod=1e9+7; char dir[]={'D','R','U','L'}; void solve(){ ll n; cin>>n; vector<double> ans(n); stack<pll>st; auto dis=[&](double x,double r,double r1)->double{ double ret= (x-r1)*(x-r1)/(4*r); return ret; }; rep(i,0,n-1){ double x,r; cin>>x>>r; double mx=r; while(!st.empty()){ pair<double,double>c=st.top(); double cr=dis(c.ff,c.ss,x); cr=min(mx,cr); if(cr>=c.ss){ st.pop(); mx=min(mx,cr); continue; }else{ mx=cr; break; } } cout<<fixed<<setprecision(3)<<mx<<"\n"; st.em(x,mx); } } signed main(){ ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr); #ifdef Usaco string f="fencedin"; freopen((f+".in").c_str(),"r",stdin); freopen((f+".out").c_str(),"w",stdout); #endif int t = 1; //cin >> t; while (t--) { solve(); } } /* ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⠀⠀⠀⢠⣾⣧⣤⡖⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠋⠀⠉⠀⢄⣸⣿⣿⣿⣿⣿⣥⡤⢶⣿⣦⣀⡀ ⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⡆⠀⠀⠀⣙⣛⣿⣿⣿⣿⡏⠀⠀⣀⣿⣿⣿⡟ ⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⠷⣦⣤⣤⣬⣽⣿⣿⣿⣿⣿⣿⣿⣟⠛⠿⠋⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠋⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⡆⠀⠀ ⠀⠀⠀⠀⣠⣶⣶⣶⣿⣦⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠈⢹⡏⠁⠀⠀ ⠀⠀⠀⢀⣿⡏⠉⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡆⠀⢀⣿⡇⠀⠀⠀ ⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣟⡘⣿⣿⣃⠀⠀⠀ ⣴⣷⣀⣸⣿⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⠹⣿⣯⣤⣾⠏⠉⠉⠉⠙⠢⠀ ⠈⠙⢿⣿⡟⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣄⠛⠉⢩⣷⣴⡆⠀⠀⠀⠀⠀ ⠀⠀⠀⠋⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⣀⡠⠋⠈⢿⣇⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀ */
#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...