# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
443109 |
2021-07-09T17:37:18 Z |
prvocislo |
Balloons (CEOI11_bal) |
C++17 |
|
707 ms |
8976 KB |
// aww geometria !! :)
#include <bits/stdc++.h>
typedef long double ld;
using namespace std;
const ld eps = 1e-6;
ld maxr(ld x1, ld r1, ld x2, ld r2)
{
ld lo = 0., hi = r2;
while (abs(lo - hi) > eps)
{
ld mi = (lo + hi) / 2.;
ld xdif = x2-x1, ydif = abs(r1 - mi);
ld prepona = sqrt(xdif*xdif+ydif*ydif);
if (prepona < r1 + mi) // jeden az dva priesecnik, mozeme ist nizsie
hi = mi;
else lo = mi;
}
return (lo + hi) / 2.;
}
bool eq(ld x, ld y) { return abs(x - y) < eps; }
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed << setprecision(3);
int n;
cin >> n;
vector<ld> x(n), r(n);
vector<int> st;
for (int i = 0; i < n; i++)
{
cin >> x[i] >> r[i];
while (st.size() > 1 && maxr(x[st.back()], r[st.back()], x[i], r[i]) > maxr(x[st[st.size() - 2]], r[st[st.size() - 2]], x[i], r[i]))
st.pop_back();
if (!st.empty()) r[i] = min(r[i], maxr(x[st.back()], r[st.back()], x[i], r[i]));
st.push_back(i);
}
for (int i = 0; i < n; i++) cout << r[i] << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
17th numbers differ - expected: '213.0000000000', found: '234.0000000000', error = '21.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
392 KB |
114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
69 ms |
1264 KB |
196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
190 ms |
2580 KB |
14045th numbers differ - expected: '15399.0000000000', found: '15419.0000000000', error = '20.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
370 ms |
4752 KB |
7310th numbers differ - expected: '7939.8510000000', found: '7941.0000000000', error = '1.1490000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
438 ms |
5444 KB |
4793rd numbers differ - expected: '0.9540000000', found: '10.6220000000', error = '9.6680000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
581 ms |
7284 KB |
1734th numbers differ - expected: '1856.0220000000', found: '1865.0000000000', error = '8.9780000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
707 ms |
8976 KB |
2723rd numbers differ - expected: '859.0470000000', found: '862.0000000000', error = '2.9530000000' |
2 |
Halted |
0 ms |
0 KB |
- |