# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
923724 |
2024-02-07T16:07:58 Z |
vanea |
Balloons (CEOI11_bal) |
C++14 |
|
164 ms |
2384 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
double calc_r(array<double, 2> a, double x) {
return (a[0] - x) * (a[0] - x) / (4 * a[1]);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
stack<array<double, 2>> s;
cout << fixed << setprecision(5);
for(int i = 0; i < n; i++) {
double x, r;
cin >> x >> r;
double mx_r = r;
while(!s.empty()) {
auto last = s.top();
double curr = calc_r(last, x);
mx_r = min(mx_r, curr);
if(mx_r >= last[1]) {
s.pop();
continue;
}
break;
}
s.push({x, mx_r});
cout << mx_r << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
2 ms |
348 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
600 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
1104 KB |
50000 numbers |
2 |
Correct |
39 ms |
852 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
1480 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
102 ms |
1832 KB |
115362 numbers |
2 |
Correct |
100 ms |
1176 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
133 ms |
2132 KB |
154271 numbers |
2 |
Correct |
156 ms |
2052 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
164 ms |
2384 KB |
200000 numbers |
2 |
Correct |
152 ms |
1876 KB |
199945 numbers |