#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define FOR(i, a, b, s) for (int i = (a); i < (b); i += s)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define pii pair<ld,ld>
#define mp make_pair
#define f first
#define s second
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int n; cin >> n;
ll x, r;
stack<pii> s;
cout << fixed << setprecision(3);
F0R(i,n) {
cin >> x >> r;
ld r1 = r;
while (s.size()) {
pii p = s.top();
ld cand = min((ld)(x-p.f)*(x-p.f)/p.s/4,(ld)r);
if (cand <= r1) {r1 = cand;}
if (cand >= p.s) {s.pop();}
else {break;}
} s.push({x,r1});
cout << r1 << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
600 KB |
3437th numbers differ - expected: '298.4460000000', found: '304.0000000000', error = '5.5540000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
860 KB |
50000 numbers |
2 |
Incorrect |
26 ms |
1768 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 |
63 ms |
1072 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 |
Correct |
65 ms |
1364 KB |
115362 numbers |
2 |
Incorrect |
55 ms |
3516 KB |
119952nd numbers differ - expected: '444418084.8249999881', found: '1000000000.0000000000', error = '555581915.1749999523' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
1624 KB |
109914th numbers differ - expected: '1404.0970000000', found: '1415.0000000000', error = '10.9030000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
91 ms |
2016 KB |
8510th numbers differ - expected: '318.4980000000', found: '320.0000000000', error = '1.5020000000' |
2 |
Halted |
0 ms |
0 KB |
- |