QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#862196#9576. Ordainer of Inexorable Judgmentchenyiwei27WA 1ms3968kbC++172.8kb2025-01-18 22:50:402025-01-18 22:50:40

Judging History

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

  • [2025-01-18 22:50:40]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3968kb
  • [2025-01-18 22:50:40]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define maxn 105
#define pi (3.14159265358979323846)
using namespace std;
ll input(){
	ll ans=0;
	char c=getchar();
	bool flag=0;
	while(c<'0'||c>'9'){
		if(c=='-')flag=1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		ans=ans*10+c-'0';
		c=getchar();
	}
	if(flag)ans=-ans;
	return ans;
}
void print(ll ans,char c=0,bool flag=1){
    if(ans<0){
        putchar('-');
        ans=-ans;
    }
    if(ans>=10)print(ans/10,c,0);
    putchar('0'+ans%10);
    if(flag&&c!=0)putchar(c);
}
ll n,x0,yy,d,cnt,circle;
ld rou[maxn],thita[maxn],kthita[maxn<<1],t,ans;
bool cmp(ld a,ld b){
	return(a<b);
}
int main(){
    n=input();x0=input();yy=input();d=input();t=input();
    circle=t/(2*pi);
    t=t-circle*2*pi;
    bool flag1=0,flag2=0;
    for(ll i=1;i<=n;i++){
    	ll x=input(),y=input();
    	if(x>0&&y>0)flag1=1;
    	if(x>0&&y<0)flag2=1;
    	rou[i]=sqrt(x*x+y*y);
    	ld k;
		if(x!=0)k=1.0*y/x;
    	if(x!=0)thita[i]=atan(k);
    	if(x>0&&y==0){
    		thita[i]=0;
		}
		if(x<0&&y==0){
    		thita[i]=pi;
		}
		if(x==0&&y>0){
    		thita[i]=pi/2;
		}
		if(x==0&&y<0){
    		thita[i]=3*pi/2;
		}
    	if(y<0&&x<0){
    		thita[i]=thita[i]+pi;
		}
		if(x<0&&y>0){
			thita[i]=thita[i]+pi;
		}
		if(x>0&&y<0){
			thita[i]=thita[i]+2*pi;			
		}
	}
	if(flag1&&flag2){
		for(ll i=1;i<=n;i++){
			if(thita[i]>pi)thita[i]=thita[i]-2*pi;
		}
	}
	//for(ll i=1;i<=n;i++)cout<<thita[i]<<' '<<endl;
	for(ll i=1;i<=n;i++){
		ld now=asin(1.0*d/rou[i]);
		kthita[++cnt]=thita[i]+now;
		kthita[++cnt]=thita[i]-now;
	}
	//for(ll i=1;i<=cnt;i++)cout<<kthita[i]<<endl;
	sort(kthita+1,kthita+cnt+1,cmp);
	ans=circle*(kthita[cnt]-kthita[1]);
//	printf("angle %0.10Lf\n",kthita[cnt]-kthita[1]);
	ld thita0,k;
	if(x0!=0)k=1.0*yy/x0;
    if(x0!=0)thita0=atan(k);
    if(x0>0&&yy==0){
    	thita0=0;
	}
	if(x0<0&&yy==0){
    	thita0=pi;
	}
	if(x0==0&&yy>0){
    	thita0=pi/2;
	}
	if(x0==0&&yy<0){
    	thita0=3*pi/2;
	}
    if(yy<0&&x0<0){
    	thita0=thita0+pi;
	}
	if(x0<0&&yy>0){
		thita0=thita0+pi;
    }
   /* if(flag1&&flag2){
		thita0=thita0-2*pi;
	}*/
    while(thita0>kthita[cnt]){
    	thita0=thita0-2*pi;
	}
	ld thitat=thita0+t;
	if(thitat<kthita[1]){
	//	cout<<11<<endl;
	}
	else if(2*pi-t<kthita[cnt]-kthita[1]&&(thitat>kthita[1]+2*pi||(thitat>kthita[1]&&thitat-kthita[1]<=pi/2))&&kthita[cnt]>thita0){
		ans=ans+thitat-kthita[1]-2*pi+kthita[cnt]-thita0;
	//	cout<<22<<endl;
	}
	else{
		ans=ans+min(thitat,kthita[cnt])-min(thita0,kthita[1]);
	//	cout<<"33"<<endl;
	}
	//cout<<t<<' '<<thitat<<" "<<thita0<<" "<<kthita[cnt]<<" "<<kthita[1]<<endl;
	printf("%.10Lf\n",ans);
    return 0;
}
/*
3 0 -1 1 1
2 -1
1 -2
2 -2
3 0 -1 1 2
2 -1
1 -2
2 -2
3 0 -1 1 10000
2 -1
1 -2
2 -2
3 0 -1 1 5
-2 -1
-1 -2
-2 -2
*/

详细

Test #1:

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

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

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

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.3843620170

result:

wrong answer 1st numbers differ - expected: '0.3842413', found: '0.3843620', error = '0.0001207'