# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
500986 |
2022-01-01T21:45:34 Z |
danielsuh |
Balloons (CEOI11_bal) |
C++17 |
|
195 ms |
9208 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int int64_t
long double get_radius(int r_1, int x_1, int y_1, int x_2) {
long double num = pow(r_1, 2LL) - pow(x_1, 2LL) + 2LL * x_1 * x_2 - pow(x_2, 2LL) - pow(y_1, 2LL);
long double den = 2LL * (y_1 + r_1);
return -num / den;
}
void solve() {
cout << fixed << setprecision(3);
int N; cin >> N;
vector<pair<int, int>> A(N); for(auto &x : A) cin >> x.first >> x.second;
vector<long double> ans(N);
stack<pair<int, int>> st;
for(int i = 0; i < N; i++) {
long double r = A[i].second;
while(!st.empty()) {
int r1 = st.top().second, x1 = st.top().first;
long double test = get_radius(r1, x1, r1, A[i].first);
r = min(r, test);
if(r >= r1) {
st.pop();
}else {
break;
}
}
st.push({A[i].first, r});
ans[i] = r;
}
for(auto &x : ans) cout << x << "\n";
}
int32_t main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int T = 1;
//cin >> T;
for(int i = 1; i <= T; ++i) {
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
8th numbers differ - expected: '8.7410000000', found: '9.0910000000', error = '0.3500000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
13th numbers differ - expected: '2.3960000000', found: '2.4500000000', error = '0.0540000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1092 KB |
44th numbers differ - expected: '165.0000000000', found: '165.0020000000', error = '0.0020000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
2860 KB |
254th numbers differ - expected: '15129.9990000000', found: '15130.0010000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
95 ms |
5220 KB |
286th numbers differ - expected: '7633.9990000000', found: '7634.0010000000', error = '0.0020000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
6076 KB |
511th numbers differ - expected: '4494.0050000000', found: '4494.0070000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
173 ms |
8256 KB |
165th numbers differ - expected: '1698.9980000000', found: '1699.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
9208 KB |
249th numbers differ - expected: '2683.0090000000', found: '2683.0110000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |