QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#514958 | #2267. Jewelry Size | Folity# | WA | 1ms | 4324kb | C++20 | 1.0kb | 2024-08-11 13:50:12 | 2024-08-11 13:50:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int N=1005;
const double pi=acos(-1);
int n,a[N];
bool chk(double r){
double sum=0;
for(int i=1;i<=n;++i)sum+=asin(a[i]/r/2);
return sum>pi;
}
bool chk2(double r){
double sum=0;
for(int i=1;i<=n-1;++i)sum+=asin(a[i]/r/2);
return sum<asin(a[n]/r/2);
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
cin>>n;
for(int i=1;i<=n;++i)cin>>a[i];
sort(a+1,a+n+1);
double l=a[n]*.5,r=1e5;
while(r-l>=1e-8){
double mid=(l+r)/2;
if(chk(mid))l=mid;
else r=mid;
}
if(chk(l))cout<<fixed<<setprecision(12)<<l<<'\n';
else{
double l=a[n]*.5,r=1e8;
while(r-l>=1e-8){
double mid=(l+r)/2;
if(chk2(mid))l=mid;
else r=mid;
}
cout<<fixed<<setprecision(12)<<l<<'\n';
}
//double area=0;
//for(int i=1;i<=n;++i)area+=a[i]*sqrt(l*l-.25*a[i]*a[i]);
//cout<<area<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4172kb
input:
5 3 1 6 1 7
output:
3.544404348393
result:
ok found '3.5444043', expected '3.5444044', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4148kb
input:
3 500 300 400
output:
250.000000000000
result:
ok found '250.0000000', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3996kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.974120597875
result:
ok found '3780.9741206', expected '3780.9741206', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4052kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
3003.139816963227
result:
ok found '3003.1398170', expected '3003.1398170', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 4324kb
input:
1000 4719 3755 2542 1190 5557 3641 5426 1578 5247 3181 3524 983 4151 4337 3004 2062 1048 4739 499 2530 1378 450 5459 651 1714 4051 416 4186 2598 1031 374 5523 4787 1122 4919 2549 4763 4345 2333 4009 5732 5857 3198 3882 2399 4409 4151 3447 1353 4650 4184 2731 3307 3642 3383 5021 5899 2005 3206 702 30...
output:
99999.999999994485
result:
wrong answer 1st numbers differ - expected: '490696.1297935', found: '100000.0000000', error = '0.7962079'