# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1100284 |
2024-10-13T12:31:46 Z |
michified |
Balloons (CEOI11_bal) |
C++17 |
|
644 ms |
13964 KB |
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define lid id * 2 + 1
#define rid id * 2 + 2
using namespace std;
const ll mod = 1e9 + 7;
ld bestR(ld x1, ld r1, ld x2, ld r2) {
ld l = 0, r = r2 + 1;
while (l < r - 0.0001) {
ld mid = (l + r) / 2;
if (sqrtl((x2 - x1) * (x2 - x1) + abs(r1 - mid) * abs(r1 - mid)) >= r1 + mid) l = mid;
else r = mid - 0.0001;
}
return min(r2, l);
}
int main() {
// ifstream cin("balancing.in");
// ofstream cout("balancing.out");
int n, i;
cin >> n;
vector<ld> x(n), r(n);
for (i = 0; i < n; i++) cin >> x[i] >> r[i];
vector<ld> ans(n);
stack<int> st;
ans[0] = r[0];
st.push(0);
for (i = 1; i < n; i++) {
ld res = r[i];
while (not st.empty()) {
res = min(res, bestR(x[st.top()], ans[st.top()], x[i], r[i]));
if (res > ans[st.top()]) st.pop();
else break;
}
ans[i] = res;
st.push(i);
}
for (i = 0; i < n; i++) cout << fixed << setprecision(3) << ans[i] << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
168th numbers differ - expected: '4.5000000000', found: '4.5020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
340 KB |
114th numbers differ - expected: '39.0180000000', found: '39.0200000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
1568 KB |
1374th numbers differ - expected: '139.5920000000', found: '139.5940000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
158 ms |
3752 KB |
36728th numbers differ - expected: '9.9570000000', found: '9.9590000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
320 ms |
7244 KB |
14857th numbers differ - expected: '7169.6020000000', found: '7169.5880000000', error = '0.0140000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
354 ms |
8524 KB |
5459th numbers differ - expected: '5071.1870000000', found: '5071.1920000000', error = '0.0050000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
474 ms |
11340 KB |
1734th numbers differ - expected: '1856.0220000000', found: '1856.0390000000', error = '0.0170000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
644 ms |
13964 KB |
2716th numbers differ - expected: '22.1690000000', found: '22.1670000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |