This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int v[maxn], r[maxn];
int main()
{
//freopen("art2.in", "r", stdin);
//freopen("art2.out", "w", stdout);
//OBS: se eu parei por causa de um balao com id y e meu id eh x, posso ignorar todos os baloes de id entre y e x
//OBS: se eu tenho uma altura menor que o proximo cara eu posso ser ignorado
//pensar: como eu consigo calcular a primeira intersecção? (dado um numero limitado de caras)
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n; cin >> n;
for(int i=1;i<=n;i++) cin >> v[i] >> r[i];
stack<pair<int,int>>st;
for(int i=1;i<=n;i++){
double xat=v[i];
while(!st.empty()){
auto p=st.top();
double xk=p.first, rk=p.second;
double rat=((xk-xat)*(xk-xat))/(4*rk);
rat=min(rat,(double)r[i]);
if(rat<rk){
cout << fixed << setprecision(3) << rat << endl;
st.push({xat,rat});
break;
}else st.pop();
}
if(st.empty()){
double rat=r[i];
cout << fixed << setprecision(3) << rat << endl;
st.push({xat,rat});
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |