QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#17908 | #2267. Jewelry Size | JohnAlfnov# | WA | 3ms | 4156kb | C++14 | 691b | 2022-01-15 09:55:04 | 2022-05-04 16:18:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int a[1005];
double x[1005];
const double pi=acos(-1);
int main(){
int n;
cin>>n;
for(int i=1;i<=n;++i)scanf("%d",&a[i]);
sort(a+1,a+n+1);
double l1=0,r1=1e7;
while(r1-l1>1e-10){
double mid=(l1+r1)/2,he=0;
for(int i=1;i<=n;++i){
x[i]=acos(1-1/2.0*a[i]*a[i]/mid/mid);
he+=x[i];
}
if(he<2*pi)r1=mid;
else l1=mid;
}
double l2=0,r2=1e7;
while(r2-l2>1e-10){
double mid=(l2+r2)/2,he=0,mx=0;
for(int i=1;i<=n;++i){
x[i]=acos(1-1/2.0*a[i]*a[i]/mid/mid);
he+=x[i],mx=max(mx,x[i]);
}
if(he>2*mx||fabs(mx-x[n])<1e-10)r2=mid;
else l2=mid;
}
printf("%.10f\n",max(l1,l2));
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3872kb
input:
5 3 1 6 1 7
output:
3.5444043509
result:
ok found '3.5444044', expected '3.5444044', error '0.0000000'
Test #2:
score: 0
Accepted
time: 3ms
memory: 4128kb
input:
3 500 300 400
output:
250.0000000000
result:
ok found '250.0000000', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3940kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.9741205994
result:
ok found '3780.9741206', expected '3780.9741206', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 3ms
memory: 4156kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
301.0000000000
result:
wrong answer 1st numbers differ - expected: '3003.1398170', found: '301.0000000', error = '0.8997716'