# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
500985 |
2022-01-01T21:43:33 Z |
danielsuh |
Balloons (CEOI11_bal) |
C++17 |
|
136 ms |
10692 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) {
ll num = pow(r_1, 2) - pow(x_1, 2) + 2 * x_1 * x_2 - pow(x_2, 2) - pow(y_1, 2);
ll den = 2 * (y_1 + r_1);
return (long double) -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 = (long double) (x1 - A[i].first) * (x1 - A[i].first) / (4 * r1);
r = min(r, test);
if(r >= r1) {
st.pop();
}else {
break;
}
}
st.push(A[i]);
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 |
5th numbers differ - expected: '17.1630000000', found: '4.3710000000', error = '12.7920000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
3rd numbers differ - expected: '0.0420000000', found: '2.0830000000', error = '2.0410000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
3rd numbers differ - expected: '121.0000000000', found: '120.0180000000', error = '0.9820000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
1336 KB |
3rd numbers differ - expected: '211.0000000000', found: '210.0110000000', error = '0.9890000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
2720 KB |
3rd numbers differ - expected: '15396.0000000000', found: '9489.3930000000', error = '5906.6070000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
5700 KB |
3rd numbers differ - expected: '7936.0000000000', found: '6084.6240000000', error = '1851.3760000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
84 ms |
6492 KB |
6th numbers differ - expected: '5053.0000000000', found: '5052.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
8636 KB |
3rd numbers differ - expected: '1872.0000000000', found: '1871.0010000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
136 ms |
10692 KB |
3rd numbers differ - expected: '2960.0000000000', found: '2959.0010000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |