#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
typedef long double ld;
const int maxn = 200010;
const int INF = LLONG_MAX/2;
const int mod = 1e9+7;
int n;
ld x[maxn], r[maxn];
int32_t main() {
FAST
// #ifndef ONLINE_JUDGE
// ifstream cin("input.txt");
// #endif
cin >> n;
for (int i =1;i<=n;i++) cin >> x[i] >> r[i];
stack <pi> s;
for (int i =1;i<=n;i++) {
while (!s.empty()) {
auto [xp, rp] = s.top();
r[i] = min(r[i], (x[i] - xp) * (x[i] - xp) / (4 * rp));
if (r[i] >= rp) s.pop();
else break;
}
s.push(pi(x[i], r[i]));
}
for (int i =1;i<=n;i++) cout << fixed << setprecision(6) << r[i] << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
8th numbers differ - expected: '8.7410000000', found: '9.0909090000', error = '0.3499090000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
13th numbers differ - expected: '2.3960000000', found: '2.4500000000', error = '0.0540000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
332 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020490000', error = '0.0020490000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
1172 KB |
71st numbers differ - expected: '136.0000000000', found: '136.0018250000', error = '0.0018250000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
69 ms |
2540 KB |
254th numbers differ - expected: '15129.9990000000', found: '15130.0013390000', error = '0.0023390000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
129 ms |
4684 KB |
286th numbers differ - expected: '7633.9990000000', found: '7634.0008190000', error = '0.0018190000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
137 ms |
5428 KB |
512th numbers differ - expected: '4502.9990000000', found: '4503.0045060000', error = '0.0055060000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
206 ms |
7080 KB |
165th numbers differ - expected: '1698.9980000000', found: '1699.0001470000', error = '0.0021470000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
228 ms |
8740 KB |
249th numbers differ - expected: '2683.0090000000', found: '2683.0112290000', error = '0.0022290000' |
2 |
Halted |
0 ms |
0 KB |
- |