///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<double,double> a[maxn];
int n;
double ans[maxn];
double sqr(long double k)
{
return k*k;
}
double cal(pair< double, double> x, double pos)
{
return sqr(pos-x.fi)/(4*x.se);
}
void solve()
{
stack<pair< double, double> > st;
//st.push()
for (int i=1;i<=n;i++)
{
double r=a[i].se;
while (st.size())
{
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
2904 KB |
653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
4896 KB |
50000 numbers |
2 |
Incorrect |
36 ms |
4812 KB |
49903rd numbers differ - expected: '443977872.4679999948', found: '1000000000.0000000000', error = '556022127.5320000648' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
5548 KB |
14857th numbers differ - expected: '7169.6020000000', found: '7176.0000000000', error = '6.3980000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
5712 KB |
23610th numbers differ - expected: '1467.9600000000', found: '1471.0000000000', error = '3.0400000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
124 ms |
6060 KB |
12335th numbers differ - expected: '4957.2960000000', found: '4967.0000000000', error = '9.7040000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
147 ms |
6704 KB |
7553rd numbers differ - expected: '198.8980000000', found: '220.0000000000', error = '21.1020000000' |
2 |
Halted |
0 ms |
0 KB |
- |