제출 #415305

#제출 시각아이디문제언어결과실행 시간메모리
415305ba_hahBalloons (CEOI11_bal)C++14
10 / 100
524 ms8292 KiB
#include <bits/stdc++.h> using namespace std; #define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define int long long void init(){ } const int N = (int) 2e5 + 8; const int mod = (int)1e9+7; int x[N] , r[N]; int n ; stack<pair<int,int>> st; int inflate( int xx , double rr ) { // for touching circle // max radius will be r = ( x1 - x) ^2 / 4*r1 // also observation // x2 > x1 for any x > x2 we have (x1-x)^2 > (x2-x)^2 // along with r1<=r2 then only r2 will require for calculation of answer for x while( !st.empty() ){ int x1 = st.top().first , r1 = st.top().second; rr = min ( rr , (double)(x1-xx)*(x1-xx)/(4.0*r1)); if( rr >= r1 ) { st.pop(); }else break; } st.push({xx,rr}); cout<<fixed<<rr<<endl; return 0; } void solve(){ cin>>n; for( int i = 0 ; i< n ;i ++) { cin>>x[i]>>r[i]; } for( int i =0 ;i < n ; i ++) { inflate( x[i] , r[i] ) ; } } int32_t main(){ FAST; init(); int t=1; /* cin>>t; */ while(t--){ 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...