# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
842503 |
2023-09-03T01:35:56 Z |
NoLove |
Balloons (CEOI11_bal) |
C++14 |
|
132 ms |
6120 KB |
/**
* author : Lăng Trọng Đạt
* created: 2023-09-02
**/
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int x[MAXN], r[MAXN];// f[i]: final radius of balloon i
double f[MAXN];
int n;
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
std::cin >> n;
for (int i = 1; i <= n; i++) {
std::cin >> x[i] >> r[i];
}
vector<int> s; // index of previous inflated balloon need to check, it will be decresing radius from top
for (int b = 1; b <= n; b++) {
f[b] = r[b];
while (!s.empty() && f[b] >= f[s.back()]) {
int a = s.back();
f[b] = min(f[b], (x[b] - x[a]) * (x[b] - x[a]) / (4 * f[a]));
if (f[b] >= f[s.back()])
s.pop_back();
}
for (int a : s) {
f[b] = min(f[b], (x[b] - x[a]) * (x[b] - x[a]) / (4 * f[a]));
}
s.push_back(b);
cout << fixed << setprecision(4) << f[b] << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '0.9334000000', error = '252735384.5045999885' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2392 KB |
259th numbers differ - expected: '153.0000000000', found: '-1953793.4735000001', error = '1953946.4735000001' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
2904 KB |
249th numbers differ - expected: '434.0000000000', found: '-1062068.0035999999', error = '1062502.0035999999' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
3408 KB |
3rd numbers differ - expected: '15396.0000000000', found: '-8140.0226000000', error = '23536.0226000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
4176 KB |
4th numbers differ - expected: '7935.0000000000', found: '-63851.0373000000', error = '71786.0373000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
92 ms |
4436 KB |
6th numbers differ - expected: '5053.0000000000', found: '-85866.8877000000', error = '90919.8877000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
5248 KB |
14th numbers differ - expected: '1861.0000000000', found: '-258455.0788000000', error = '260316.0788000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
132 ms |
6120 KB |
9th numbers differ - expected: '2952.0000000000', found: '-173449.3342000000', error = '176401.3342000000' |
2 |
Halted |
0 ms |
0 KB |
- |