QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#17908#2267. Jewelry SizeJohnAlfnov#WA 3ms4156kbC++14691b2022-01-15 09:55:042022-05-04 16:18:07

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-04 16:18:07]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4156kb
  • [2022-01-15 09:55:04]
  • 提交

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'