QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#18212#2267. Jewelry SizeRealityang#WA 3ms5896kbC++141.0kb2022-01-16 20:06:322022-05-04 17:20:56

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:20:56]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:5896kb
  • [2022-01-16 20:06:32]
  • 提交

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-10;
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;
	}
	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;
	}
	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;
	if(an2==-1.0)cout<<setprecision(10)<<fixed<<an1;
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 5836kb

input:

5
3 1 6 1 7

output:

3.5444043509

result:

ok found '3.5444044', expected '3.5444044', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 5896kb

input:

3
500 300 400

output:

-1.0000000000-1.0000000000

result:

wrong output format Expected double, but "-1.0000000000-1.0000000000" found