# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1105021 |
2024-10-25T07:51:33 Z |
ezzzay |
Balloons (CEOI11_bal) |
C++14 |
|
2000 ms |
7312 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
double x[N],r[N];
double p[N];
bool check(int i, int j, double R){
double xj=x[j],yj=p[j],rj=p[j];
double xi=x[i],yi=R,ri=R;
double d=(xi-xj)*(xi-xj)+(yi-yj)*(yi-yj);
double f=rj+ri;
if(f*f<=d){
return 1;
}
else{
return 0;
}
}
signed main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>x[i]>>r[i];
}
p[1]=r[1];
for(int i=2;i<=n;i++){
double lo=0,hi=r[i];
while(hi>=lo){
double mid=(hi+lo)/2;
bool u=1;
for(int j=1;j<i;j++){
u&=check(i,j,mid);
}
if(u){
lo=mid+0.0001;
}
else{
hi=mid-0.0001;
}
}
p[i]=hi;
}
for(int i=1;i<=n;i++){
cout<<fixed<<setprecision(3)<<p[i]<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4432 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4432 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
4552 KB |
480th numbers differ - expected: '22.8290000000', found: '22.8260000000', error = '0.0030000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
4432 KB |
397th numbers differ - expected: '137.2240000000', found: '137.2270000000', error = '0.0030000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2061 ms |
5036 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2060 ms |
5372 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2045 ms |
5960 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2043 ms |
6472 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2048 ms |
6884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2054 ms |
7312 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |