Submission #1114257

#TimeUsernameProblemLanguageResultExecution timeMemory
1114257asli_bgBalloons (CEOI11_bal)C++11
0 / 100
31 ms3920 KiB
#include <bits/stdc++.h> using namespace std; #define int double #define fi first #define se second #define all(x) x.begin(),x.end() #define sp <<' '<< #define FOR(i,a) for(int i=0;i<(a);i++) #define FORE(i,a,b) for(int i=(a);i<(b);i++) #define cont(a) for(auto el:a) cout<<el<<' '; cout<<endl; #define contp(a) for(auto el:a) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl; #define DEBUG(x) cout<<#x sp ":" sp x<<endl; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vii; typedef long long ll; #define endl '\n' #define mid (l+r)/2 const int MAXN=2e5+5; int n; bool check(int a,int b,int c){ //c max possible hipotenus int hipo=pow(a,2)+pow(b,2); if(c>=sqrt(hipo)){ //kesişiyorlar return true; } return false; } int findr(int mxr,int prevr,int xfark){ //kesiştikleri son noktayı bul int l=0; int r=mxr; FOR(i,50){ if(check(abs(mid-prevr),xfark,mid+prevr)) r=mid; else l=mid; } return l; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout<<fixed<<setprecision(3); cin>>n; vi cev(n+1,0); stack<pii> s; //{x eksenini nereden keser, radyan ne kadar} FORE(i,1,n+1){ int x,r; cin>>x>>r; if(i==1) s.push({x,r}); else{ pii el; while(r>el.se){ el=s.top(); int deg=findr(r,el.se,x-el.fi); r=deg; if(r>el.se) s.pop(); } s.push({x,r}); } cout<<r<<endl; } }
#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...