# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1116633 |
2024-11-22T02:58:14 Z |
pemguimn |
Balloons (CEOI11_bal) |
C++17 |
|
129 ms |
8504 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, x[N], r[N];
long double ans[N];
long double calc(int i, int j){
double x1 = x[i], y1 = ans[i];
double x2 = x[j];
return (x1 * x1 + x2 * x2 - 2.0L * x1 * x2 ) / (4.0L * y1);
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> x[i] >> r[i];
ans[i] = r[i];
}
stack<int> st;
for(int i = 1; i <= n; i++){
long double reach = r[i];
while(st.size()){
reach = min(reach, calc(st.top(), i));
if(reach < ans[st.top()]) break;
st.pop();
}
ans[i] = reach;
st.push(i);
}
for(int i = 1; i <= n; i++)
cout << setprecision(3) << fixed << ans[i] << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
4868 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
5456 KB |
10079th numbers differ - expected: '4256.0000000000', found: '4255.9980000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
74 ms |
6936 KB |
14707th numbers differ - expected: '159.0020000000', found: '159.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
88 ms |
7496 KB |
16002nd numbers differ - expected: '1629.0240000000', found: '1629.0260000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
121 ms |
8504 KB |
18470th numbers differ - expected: '191.9810000000', found: '191.9790000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
129 ms |
8184 KB |
44644th numbers differ - expected: '160.0020000000', found: '160.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |