#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, double>
#define ll long long
int main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
cout << fixed;
cout << setprecision(3);
int n;
cin >> n;
stack<pii> balloons;
for (int i = 0; i < n; i++)
{
int a, b;
cin >> a >> b;
double sol = b;
while (balloons.size())
{
ll dn = a-balloons.top().first;
double r = balloons.top().second;
if ((r+b)*(r+b) >= dn*dn+(r-b)*(r-b))
{
sol = (dn*dn)/(4*r);
}
if (r>sol)break;
balloons.pop();
}
balloons.push({a, sol});
cout << sol << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
10 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
14th numbers differ - expected: '2.6090000000', found: '7.1410000000', error = '4.5320000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
348 KB |
79th numbers differ - expected: '36.0070000000', found: '2269.3920000000', error = '2233.3850000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
972 KB |
137th numbers differ - expected: '67.1010000000', found: '2333.0760000000', error = '2265.9750000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
111 ms |
1580 KB |
8577th numbers differ - expected: '5928.9960000000', found: '23676.0340000000', error = '17747.0380000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
216 ms |
2844 KB |
3839th numbers differ - expected: '3727.0020000000', found: '14896.0010000000', error = '11168.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
258 ms |
3152 KB |
1580th numbers differ - expected: '3316.0000000000', found: '13260.0010000000', error = '9944.0010000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
335 ms |
3952 KB |
326th numbers differ - expected: '1528.0010000000', found: '6104.0030000000', error = '4576.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
438 ms |
4736 KB |
474th numbers differ - expected: '2445.0010000000', found: '9772.0010000000', error = '7327.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |