#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
#include <iomanip>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<pii,pii>
#define vi vector<int>
#define pb push_back
//#define p push
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define int long long
#define double long double
const int mxn=1e5,inf=1e18;
double cal(int x,double r){return (double)(((x*x)*1.0)/(4*r*1.0));}
deque<int>dq;
int32_t main(){
fastio
int n;cin>>n;
vector<pair<int,double>>v(n);
vector<double>sz(n,0);
for(int i=0;i<n;i++)cin>>v[i].f>>v[i].s;
for(int i=0;i<n;i++){
if(dq.empty()){
sz[i]=v[i].s;
dq.push_back(i);
continue;
}
while(dq.size()>1&&(cal(v[i].f-v[dq[dq.size()-1]].f,sz[dq[dq.size()-1]])>cal(v[i].f-v[dq[dq.size()-2]].f,sz[dq[dq.size()-2]])))dq.pop_back();
sz[i]=min(v[i].s,cal(v[i].f-v[dq.back()].f,sz[dq.back()]));
while(!dq.empty()&&(sz[i]>sz[dq.back()]))dq.pop_back();
dq.push_back(i);
}
cout<<setprecision(3)<<fixed;
for(auto i:sz)cout<<i<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
10 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
53rd numbers differ - expected: '213.0000000000', found: '235.0000000000', error = '22.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
1372 KB |
653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
48 ms |
3276 KB |
14174th numbers differ - expected: '0.7720000000', found: '1.3710000000', error = '0.5990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
75 ms |
6012 KB |
7447th numbers differ - expected: '0.9750000000', found: '8.0000000000', error = '7.0250000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
85 ms |
6940 KB |
4793rd numbers differ - expected: '0.9540000000', found: '10.6220000000', error = '9.6680000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
110 ms |
9048 KB |
1785th numbers differ - expected: '2.2550000000', found: '10.0000000000', error = '7.7450000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
151 ms |
11344 KB |
2914th numbers differ - expected: '0.8600000000', found: '9.0000000000', error = '8.1400000000' |
2 |
Halted |
0 ms |
0 KB |
- |