# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
500988 |
2022-01-01T21:47:13 Z |
danielsuh |
Balloons (CEOI11_bal) |
C++17 |
|
232 ms |
12740 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long double
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(10);
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, long double>> 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 |
Correct |
0 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 |
Correct |
1 ms |
332 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
460 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
1508 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
3748 KB |
26091st numbers differ - expected: '0.6430000000', found: '0.6449994163', error = '0.0019994163' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
121 ms |
6776 KB |
14857th numbers differ - expected: '7169.6020000000', found: '7169.6092910692', error = '0.0072910692' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
141 ms |
7896 KB |
23610th numbers differ - expected: '1467.9600000000', found: '1467.9427840233', error = '0.0172159767' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
189 ms |
10152 KB |
18635th numbers differ - expected: '3964.4000000000', found: '3964.3956867448', error = '0.0043132552' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
232 ms |
12740 KB |
45825th numbers differ - expected: '402.4740000000', found: '402.4759291778', error = '0.0019291778' |
2 |
Halted |
0 ms |
0 KB |
- |