# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1116624 |
2024-11-22T02:40:42 Z |
pemguimn |
Balloons (CEOI11_bal) |
C++17 |
|
106 ms |
6472 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 * x1 * x2 ) / (4 * 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];
for(int j = i - 1; j >= 0; j--){
if(x[i] - x[j] >= reach + ans[j]) break;
reach = min(reach, calc(j, i));
}
ans[i] = reach;
}
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 |
336 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
399th numbers differ - expected: '9.9760000000', found: '37.0000000000', error = '27.0240000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
1104 KB |
1209th numbers differ - expected: '72.2820000000', found: '178.0000000000', error = '105.7180000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1888 KB |
9349th numbers differ - expected: '5056.0090000000', found: '5056.0070000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
3668 KB |
7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
4184 KB |
4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
87 ms |
5368 KB |
1736th numbers differ - expected: '0.0050000000', found: '3.0000000000', error = '2.9950000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
106 ms |
6472 KB |
2718th numbers differ - expected: '2.2100000000', found: '3.0000000000', error = '0.7900000000' |
2 |
Halted |
0 ms |
0 KB |
- |