# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
962513 |
2024-04-13T17:56:30 Z |
VKnight |
Balloons (CEOI11_bal) |
C++17 |
|
132 ms |
7220 KB |
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define gett(tup,ind) get<ind>(tup)
#define print(x) for (auto i:x){cout<<i<<endl;};
using namespace std;
bool check(int x1,double r1,int x2,double r2){
double dis=(x1-x2)*(x1-x2)+(r1-r2)*(r1-r2);
return (r1+r2)*(r1+r2)<=dis;
}
double rad(int x1,double r1,int x2,double r2){
if (check(x1,r1,x2,r2))return r2;
double strt=0,ans=0;
while (strt+0.0001<=r2){
double mid=strt+(r2-strt)/2;
if (check(x1,r1,x2,mid)){ans=mid;strt=mid;}
else{r2=mid;}
}
return ans;
}
void solve(){
int n;cin>>n;
vector <int> pos(n),lim(n);
for (int i=0;i<n;i++)cin>>pos[i]>>lim[i];
vector <double> ans(n);
stack <int> stk;
for (int i=0;i<n;i++){
double r=lim[i];
while (stk.size() && !check(pos[stk.top()],ans[stk.top()],pos[i],r)){r=rad(pos[stk.top()],ans[stk.top()],pos[i],r);stk.pop();}
ans[i]=r;
stk.emplace(i);
}
cout<<setprecision(4);
print(ans);
return;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int no_test=1;
//cin>>no_test;
while (no_test--){solve();}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 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 |
0 ms |
348 KB |
1st numbers differ - expected: '247294217.0000000000', found: '247300000.0000000000', error = '5783.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
600 KB |
2nd numbers differ - expected: '122.0020000000', found: '122.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
1100 KB |
50th numbers differ - expected: '159.0020000000', found: '159.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
2136 KB |
1st numbers differ - expected: '15399.0000000000', found: '15400.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
69 ms |
3920 KB |
15th numbers differ - expected: '7918.0000000000', found: '0.0000000000', error = '7918.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
81 ms |
4508 KB |
8th numbers differ - expected: '5051.0000000000', found: '0.0000000000', error = '5051.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
5864 KB |
26th numbers differ - expected: '1849.0000000000', found: '0.0000000000', error = '1849.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
132 ms |
7220 KB |
17th numbers differ - expected: '2945.0000000000', found: '0.0000000000', error = '2945.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |