제출 #880187

#제출 시각아이디문제언어결과실행 시간메모리
880187lambd47Balloons (CEOI11_bal)C++14
10 / 100
195 ms10728 KiB
#include<bits/stdc++.h> using namespace std; const double INF=1e9+7; double calc(double p1,double r1,double p2){ if(r1==0){ return 0; } return double ((p2-p1)*(p2-p1))/(4*r1); } int main(){ int n; cin>>n; vector<double> pos(n); vector<double> maxr(n);//maximo vector<double> raio(n); for(int i=0;i<n;i++){ cin>>pos[i]>>maxr[i]; } vector<pair<int,int>> fila; cout<<fixed<<setprecision(3); for(int i=0;i<n;i++){ while(fila.size()>1 && calc(fila.back().first,fila.back().second,pos[i])>calc(fila[fila.size()-2].first,fila[fila.size()-2].second,pos[i])){ fila.pop_back(); } if(fila.empty()){ raio[i]=maxr[i]; } else if(calc(fila.back().first,fila.back().second,pos[i])<maxr[i]){ raio[i]=calc(fila.back().first,fila.back().second,pos[i]); } else{ raio[i]=maxr[i]; } fila.push_back({pos[i],raio[i]}); } for(int i=0;i<n;i++){ cout<<raio[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...