QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#758562#9576. Ordainer of Inexorable JudgmentwyhaoWA 1ms4416kbC++141.5kb2024-11-17 18:50:482024-11-17 18:50:48

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-17 18:50:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4416kb
  • [2024-11-17 18:50: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);
	cin>>n>>xx0>>yy0>>d>>t;
	for(int i=1;i<=n;i++) cin>>px[i]>>py[i];
	db alpha = atan2(py[1],px[1]);
	db nx = xx0 * cos(alpha)+yy0*sin(alpha);
	db ny = xx0 * sin(-alpha)+yy0*cos(alpha);
	xx0=nx;
	yy0=ny;
	now = atan2(yy0,xx0);
	if(now <= -pi) now += 2*pi;
	for(int i=1;i<=n;i++){
		nx = px[i] * cos(alpha)+py[i]*sin(alpha);
		ny = px[i] * sin(-alpha)+py[i]*cos(alpha);
		px[i]=nx;
		py[i]=ny;
		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];
		pout[i]=the[i]+theh[i];
//		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]);
	}
	dlt = out - in;
	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: 0ms
memory: 4416kb

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: 1ms
memory: 4148kb

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: 1ms
memory: 4416kb

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

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

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: 0
Accepted
time: 1ms
memory: 4348kb

input:

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

output:

4999.2191154088

result:

ok found '4999.2191154', expected '4999.2191154', error '0.0000000'

Test #7:

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

input:

4 1 0 1 10000
-2 3300
-4 10000
-4 -10000
-2 -3300

output:

4999.2003918547

result:

ok found '4999.2003919', expected '4999.2003919', error '0.0000000'

Test #8:

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

input:

4 -3040 2716 2147 2
-9033 -8520
-8999 -8533
-8988 -8511
-9004 -8495

output:

0.3508300583

result:

ok found '0.3508301', expected '0.3508301', error '0.0000000'

Test #9:

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

input:

3 8168 -766 1549 1256
-3951 -6425
-3874 -6439
-3911 -6389

output:

82.5974001985

result:

wrong answer 1st numbers differ - expected: '84.8328612', found: '82.5974002', error = '0.0263514'