QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#18214#2267. Jewelry SizeRealityang#WA 8ms5960kbC++141.1kb2022-01-16 20:11:172022-05-04 17:21:12

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 17:21:12]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:5960kb
  • [2022-01-16 20:11:17]
  • 提交

answer

#include<bits/stdc++.h>
#define double long double
using namespace std;
const int N=1000010,mod=1e9+7;
const double eps=1e-12,ee=1e-6;
int n,a[N];
double b[N];
void sun(double r){for(int i=1;i<=n;i++)b[i]=2.0*asin((double)a[i]*0.5/r);sort(b+1,b+n+1);}
signed main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}sort(a+1,a+n+1);
	double an1=-1,an2=-1;
	double ll=a[n]/2.0,rr=1e5;
	while(rr-ll>=eps){
		double r=(ll+rr)/2.0,su=0;
		sun(r);
		for(int i=1;i<=n;i++)su+=b[i];
		double j1=su-2.0*acos(-1);
		if(j1<0)rr=r;
		else ll=r;
	}
	rr=(ll+rr)/2.0;
	sun(rr);double ss=0;
	for(int i=1;i<=n;i++)ss+=b[i];
	double j1=ss-2.0*acos(-1);
	if(j1>-ee&&j1<ee)an1=rr;
	ll=a[n]/2.0,rr=1e5;
	while(rr-ll>=eps){
		double r=(ll+rr)/2.0,su=0;
		sun(r);
		for(int i=1;i<n;i++)su+=b[i];
		double j2=b[n]-su;
		if(j2<0)rr=r;
		else ll=r;
	}
	rr=(ll+rr)/2.0;
	sun(rr);ss=0;
	for(int i=1;i<n;i++)ss+=b[i];
	double j2=b[n]-ss;
	if(j2>-ee&&j2<ee)an2=rr;
	if(an1==-1.0)cout<<setprecision(10)<<fixed<<an2;
	else cout<<setprecision(10)<<fixed<<an1;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 5892kb

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: 2ms
memory: 5836kb

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: 0ms
memory: 5788kb

input:

8
2000 3000 4000 2000 3000 4000 2000 3000

output:

3780.9741205995

result:

ok found '3780.9741206', expected '3780.9741206', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 5960kb

input:

10
602 67 67 67 67 67 67 67 67 67

output:

3003.1398169653

result:

ok found '3003.1398170', expected '3003.1398170', error '0.0000000'

Test #5:

score: -100
Wrong Answer
time: 8ms
memory: 5772kb

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:

-1.0000000000

result:

wrong answer 1st numbers differ - expected: '490696.1297935', found: '-1.0000000', error = '1.0000020'