#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
#define f first
#define s second
#define MOD 1000000007
#define LOGN 12
#define MAXN 3000000
typedef long double ld;
ld find(ld r1, ll x1, ll x2) {
ll d_sq = (x2 - x1) * (x2 - x1);
ld ans = (d_sq * 1.0) / (4 * r1);
return ans;
}
int main() {
fast
int n;
cin >> n;
vector<pair<ll,ll>> bal(n+1);
vector<ld> ans(n+1);
for (int i = 1; i <= n; i++)
cin >> bal[i].f >> bal[i].s;
stack<pair<ll, ld>> st;
for (int i = 1; i <= n; i++) {
ans[i] = (ld)bal[i].s;
while (!st.empty()) {
pair<ll, ld> p = st.top();
ld q = find(p.s, p.f, bal[i].f);
if (q > ans[i]) {
break;
} else {
st.pop();
ans[i] = q;
}
}
st.push({bal[i].f, ans[i]});
}
cout << setprecision(10) << fixed;
for (int i = 1; i <= n; i++)
cout << ans[i] << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
316 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
408 KB |
114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
1628 KB |
196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
3668 KB |
13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
7008 KB |
7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
82 ms |
8056 KB |
4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
110 ms |
10692 KB |
1730th numbers differ - expected: '5.6890000000', found: '6.8055555556', error = '1.1165555556' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
145 ms |
13616 KB |
2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000' |
2 |
Halted |
0 ms |
0 KB |
- |