QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#758497#9576. Ordainer of Inexorable JudgmentwyhaoWA 1ms4340kbC++141.4kb2024-11-17 18:35:482024-11-17 18:35:49

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-17 18:35:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4340kb
  • [2024-11-17 18:35:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=105;
typedef double db;
const db eps = 1e-8;
const db pi = acos(-1.0);
int n,d;
db xx0,yy0,t;
db px[N],py[N];
db the[N],theh[N];
db pin[N],pout[N];
db in,out,now,ans,dlt;
int main(){
//	freopen("ex.in","r",stdin);
//	scanf("%d%lf%lf%d%lf",&n,&xx0,&yy0,&d,&t);
	cin>>n>>xx0>>yy0>>d>>t;
	for(int i=1;i<=n;i++){
//		scanf("%lf%lf",&px[i],&py[i]);
		cin>>px[i]>>py[i];
		theh[i]=asin(d/sqrt((px[i]*px[i]+py[i]*py[i])));
		the[i]=atan2(py[i],px[i]);
		pin[i]=the[i]-theh[i];
		if(pin[i]<=-pi) pin[i]+=2*pi;
		pout[i]=the[i]+theh[i];
		if(pout[i]<=-pi) pout[i]+=2*pi;
//		printf("%lf %lf ",the[i],theh[i]);
//		printf("%lf %lf\n",pin[i],pout[i]);
	}
	in=pin[1];out=pout[1];
	for(int i=2;i<=n;i++){
		in=min(in,pin[i]);
		out=max(out,pout[i]);
	}
	now = atan2(yy0,xx0);
	if(now <= -pi) now += 2*pi;
	dlt = out - in;
	while(dlt <= -pi) dlt += 2*pi;
	while(t>2*pi){
		t-=2*pi;
		ans += dlt;
	}
	while(out < in) out +=2*pi;
//	printf("%.10lf %.10lf\n",in,out);
//	printf("%lf\n",t);
//	printf("%lf\n",ans);
	in -= now;
	out -= now;
//	printf("%.10lf %.10lf\n",in,out);
	while(in <= -pi){
		in += 2*pi;
		out+= 2*pi;
	}
	while(in>pi){
		out -= 2*pi;
		in -= 2*pi;
	}
	if(t>=out){
		ans += out - max<db>(in,0.0);
	}else if(t>=in){
		ans += t - max<db>(in,0.0);
	}
	printf("%.10lf",double(ans));
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4300kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.5707963268

result:

ok found '1.5707963', expected '1.5707963', error '0.0000000'

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.7077522575

result:

ok found '2500.7077523', expected '2500.7077523', error '0.0000000'

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.3842413003

result:

ok found '0.3842413', expected '0.3842413', error '0.0000000'

Test #5:

score: 0
Accepted
time: 1ms
memory: 4200kb

input:

3 -10000 -10000 10000 10000
-10000 -9999
-10000 -10000
-9999 -10000

output:

2500.2406700096

result:

ok found '2500.2406700', expected '2500.2406700', error '0.0000000'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 4108kb

input:

4 1 0 1 10000
-2 3400
-4 10000
-4 -10000
-2 -3400

output:

5002.6532372354

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '5002.6532372', error = '0.0006869'