QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#514952#2267. Jewelry SizeFolity#WA 1ms4164kbC++20665b2024-08-11 13:45:562024-08-11 13:45:59

Judging History

This is the latest submission verdict.

  • [2024-08-11 13:45:59]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 4164kb
  • [2024-08-11 13:45:56]
  • Submitted

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;
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;++i)cin>>a[i];
    double l=*max_element(a+1,a+n+1)*.5,r=1e5;
    while(r-l>=1e-8){
        double mid=(l+r)/2;
        if(chk(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: 1ms
memory: 4060kb

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: 4164kb

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: 3972kb

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: -100
Wrong Answer
time: 0ms
memory: 4164kb

input:

10
602 67 67 67 67 67 67 67 67 67

output:

301.000000000000

result:

wrong answer 1st numbers differ - expected: '3003.1398170', found: '301.0000000', error = '0.8997716'