# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
442669 |
2021-07-08T14:28:15 Z |
oneskovic |
Balloons (CEOI11_bal) |
C++14 |
|
281 ms |
5828 KB |
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
using namespace std;
typedef long long ll;
struct stack_element
{
double x, radius;
};
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
stack<stack_element> s;
for (int i = 0; i < n; i++)
{
double new_x, max_radius; cin >> new_x >> max_radius;
while (!s.empty())
{
double prev_radius = s.top().radius;
double prev_x = s.top().x;
double dx = (prev_x - new_x);
double radius_to_intersect = (dx*dx / (2.0 * prev_radius)) / 2.0;
max_radius = min(max_radius, radius_to_intersect);
if (max_radius >= prev_radius)
{
s.pop();
}
else
break;
}
s.push({ new_x,max_radius });
cout << fixed << setprecision(5);
cout << max_radius << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
332 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
452 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
70 ms |
948 KB |
50000 numbers |
2 |
Correct |
67 ms |
1700 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
1476 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
164 ms |
1712 KB |
115362 numbers |
2 |
Correct |
165 ms |
3720 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
218 ms |
2088 KB |
154271 numbers |
2 |
Correct |
265 ms |
5828 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
281 ms |
2312 KB |
200000 numbers |
2 |
Correct |
262 ms |
5828 KB |
199945 numbers |