# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
889550 |
2023-12-20T01:56:54 Z |
ilef |
Balloons (CEOI11_bal) |
C++14 |
|
255 ms |
7156 KB |
#include <bits/stdc++.h>
using namespace std;
const int PRECISION = 3;
double calc_r(pair<double, double> a, double bx) {
return (a.first - bx) * (a.first - bx) / (4 * a.second);
}
int main() {
int n;
cin >> n;
vector<double> final_radius(n);
stack<pair<double, double>> to_check;
for (int i = 0; i < n; i++) {
double x, r;
cin >> x >> r;
double max_r = r;
while (!to_check.empty()) {
pair<double, double> last = to_check.top();
double to_last_r = calc_r(last, x);
max_r = min(max_r, to_last_r);
if (max_r >= last.second) {
to_check.pop();
continue;
}
else {
break;
}
}
to_check.push({x, max_r});
final_radius[i] = max_r;
}
cout << fixed << setprecision(PRECISION);
for (double &r : final_radius) { cout << r << "\n"; }
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
436 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
860 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
1900 KB |
50000 numbers |
2 |
Correct |
63 ms |
2116 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
121 ms |
3476 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
145 ms |
4312 KB |
115362 numbers |
2 |
Correct |
153 ms |
4296 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
187 ms |
5204 KB |
154271 numbers |
2 |
Correct |
255 ms |
6956 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
237 ms |
6488 KB |
200000 numbers |
2 |
Correct |
254 ms |
7156 KB |
199945 numbers |