QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#758456#9576. Ordainer of Inexorable JudgmentwyhaoWA 0ms4060kbC++141.2kb2024-11-17 18:24:032024-11-17 18:24:04

Judging History

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

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

answer

#include<bits/stdc++.h>
using namespace std;
const int N=105;
typedef long 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("%lf %lf\n",in,out);
//	printf("%lf\n",now);
//	printf("%lf\n",ans);
	in -= now;
	out -= now;
	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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3868kb

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

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

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

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

input:

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

output:

2499.4551718412

result:

wrong answer 1st numbers differ - expected: '2500.2406700', found: '2499.4551718', error = '0.0003142'