///0-0 : what is your motivation, quan606303?
///quan606303 : Hutao
/*idea :
*/
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define INTMAX INT_MAX
#define INTMIN INT_MIN
#define LONGMAX LLONG_MAX
#define LONGMIN LLONG_MIN
#define fi first
#define se second
#define memfull(a,b) memset(a,b,sizeof(a));
#define endl '\n'
#define file(a) freopen(a".inp","r",stdin); freopen(a".out","w",stdout);
using namespace std;
const int MOD=1e9+7;
const int maxn=200005;
pair<int,int> a[maxn];
int n;
long double ans[maxn];
long double sqr(long double k)
{
return k*k;
}
long double cal(pair<long double,long double> x, long double pos)
{
return sqr(pos-x.fi)/(4*x.se);
}
void solve()
{
stack<pair<long double,long double> > st;
//st.push()
for (int i=1;i<=n;i++)
{
long double r=a[i].se;
while (st.size())
{
long double cnt=cal(st.top(),a[i].fi);
r=min(r,cnt);
if (cnt>=st.top().se)st.pop();
else break;
}
ans[i]=r;
st.push({a[i].fi,ans[i]});
}
for (int i=1;i<=n;i++)cout<<setprecision(3)<<fixed<<ans[i]<<endl;
}
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//file("");
cin>>n;
for (int i=1;i<=n;i++)cin>>a[i].fi>>a[i].se;
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
10 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2396 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
505 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2396 KB |
504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
5208 KB |
653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
4956 KB |
50000 numbers |
2 |
Incorrect |
26 ms |
5980 KB |
49903rd numbers differ - expected: '443977872.4679999948', found: '1000000000.0000000000', error = '556022127.5320000648' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
60 ms |
5968 KB |
14857th numbers differ - expected: '7169.6020000000', found: '7176.0000000000', error = '6.3980000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
69 ms |
6324 KB |
23610th numbers differ - expected: '1467.9600000000', found: '1471.0000000000', error = '3.0400000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
96 ms |
7252 KB |
12335th numbers differ - expected: '4957.2960000000', found: '4967.0000000000', error = '9.7040000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
119 ms |
8056 KB |
7553rd numbers differ - expected: '198.8980000000', found: '220.0000000000', error = '21.1020000000' |
2 |
Halted |
0 ms |
0 KB |
- |