#ifndef Local
#pragma GCC optimize("O3,unroll-loops")
#endif
#include <bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
const int lim=2e5+1;
int mod=1e9+7;
using pii=pair<int,int>;
void solve(){
int n;
cin>>n;
double x[n],r[n];
for(int i=0;i<n;i++){
cin>>x[i]>>r[i];
}
cout<<fixed<<setprecision(3);
stack<pair<double,double>>s;
for(int i=0;i<n;i++){
auto check=[&]()->bool {
double dist=abs(x[i]-s.top().second),cur=dist*dist/(4*s.top().first);
if(r[i]<cur)return 0;
if(s.top().first<cur)return 1;
return 0;
};
while(s.size()&&check()){
s.pop();
}
if(!s.size()){
cout<<r[i]<<"\n";
s.push({r[i],x[i]});
continue;
}
double dist=abs(x[i]-s.top().second),cur=dist*dist/(4*s.top().first);
if(r[i]<cur){
cout<<r[i]<<"\n";
s.push({r[i],x[i]});
}else{
cout<<cur<<"\n";
s.push({cur,x[i]});
}
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifdef Local
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#else
//freopen("dishes.in","r",stdin);
//freopen("dishes.out","w",stdout);
#endif
int t=1;
//cin>>t;
while (t--)
{
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
79th numbers differ - expected: '36.0070000000', found: '2766.0000000000', error = '2729.9930000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
1368 KB |
137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
2908 KB |
250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
76 ms |
5720 KB |
162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
89 ms |
6448 KB |
510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
129 ms |
8480 KB |
161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
150 ms |
10576 KB |
248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000' |
2 |
Halted |
0 ms |
0 KB |
- |