#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
8th numbers differ - expected: '8.7410000000', found: '9.0910000000', error = '0.3500000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
344 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
856 KB |
44th numbers differ - expected: '165.0000000000', found: '165.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
81 ms |
1836 KB |
250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
159 ms |
3412 KB |
162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
189 ms |
3916 KB |
510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
261 ms |
5200 KB |
161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
350 ms |
6364 KB |
248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000' |
2 |
Halted |
0 ms |
0 KB |
- |