# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1100287 |
2024-10-13T12:34:58 Z |
michified |
Balloons (CEOI11_bal) |
C++17 |
|
702 ms |
11352 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.001) {
ld mid = (l + r) / 2;
if (sqrtl((x2 - x1) * (x2 - x1) + abs(r1 - mid) * abs(r1 - mid)) >= r1 + mid) l = mid;
else r = mid;
}
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] + 0.002 << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
1st numbers differ - expected: '24.0000000000', found: '24.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
1st numbers differ - expected: '247294217.0000000000', found: '247294217.0020000041', error = '0.0020000041' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
1st numbers differ - expected: '213.0000000000', found: '213.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
336 KB |
1st numbers differ - expected: '123.0000000000', found: '123.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
1372 KB |
1st numbers differ - expected: '213.0000000000', found: '213.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
170 ms |
3144 KB |
1st numbers differ - expected: '15399.0000000000', found: '15399.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
356 ms |
5872 KB |
1st numbers differ - expected: '7938.0000000000', found: '7938.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
404 ms |
6872 KB |
1st numbers differ - expected: '5060.0000000000', found: '5060.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
566 ms |
9032 KB |
1st numbers differ - expected: '1874.0000000000', found: '1874.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
702 ms |
11352 KB |
1st numbers differ - expected: '2962.0000000000', found: '2962.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |