# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
548927 |
2022-04-14T18:43:33 Z |
erto |
Balloons (CEOI11_bal) |
C++17 |
|
287 ms |
7576 KB |
#include <bits/stdc++.h>
typedef long long int ll;
#define INF (1e9 + 7)
#define INF2 (998244353)
#define N (ll)1e6+1005
using namespace std;
int n;
long double g, t, h, t1, t2, t3;
long double ans2;
stack<pair<ll, ll>> s;
long double f(long double x, long double y){
long double t1 = y * y, l=0, r=y, mid, ans = 1e9;
while(r - l >= 1e-4){
mid = (r + l) / 2;
if(t1 + (x - mid) * (x - mid) <= (mid + x) * (mid + x)){
ans = mid;
r = mid;
}
else{
l = mid;
}
}
return ans;
}
void solve(){
cin >> n;
for(int i=1; i<=n; i++){
cin >> g >> h;
if(s.empty()){
s.push({g, h});
cout << h << "\n";
}
else{
tie(t1, t2) = s.top();
ans2 = f(t2, (g - t1));
t = min(h, ans2);
if(t + h >= t1 + t2){
s.pop();
while(!s.empty()){
tie(t1, t2) = s.top();
ans2 = f(t2, (g - t1));
t = min(h, ans2);
if(t1 + t2 > g + t)break;
s.pop();
}
cout << t << "\n";
s.push({g, t});
}
else{
cout << t<<'\n';
s.push({g, t});
}
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int T = 1;
//cin>>T;
while (T--){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
324 KB |
1st numbers differ - expected: '247294217.0000000000', found: '247294000.0000000000', error = '217.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
4th numbers differ - expected: '0.0950000000', found: '3.0000000000', error = '2.9050000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
332 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
968 KB |
35th numbers differ - expected: '174.0000000000', found: '174.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
2048 KB |
251st numbers differ - expected: '15123.0020000000', found: '15123.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
151 ms |
3948 KB |
285th numbers differ - expected: '7629.0020000000', found: '7629.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
181 ms |
4440 KB |
511th numbers differ - expected: '4494.0050000000', found: '4494.0100000000', error = '0.0050000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
213 ms |
5900 KB |
164th numbers differ - expected: '1698.0020000000', found: '1698.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
287 ms |
7576 KB |
248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |