QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#725311#9576. Ordainer of Inexorable Judgmentucup-team1338#WA 1ms4328kbC++232.1kb2024-11-08 17:05:082024-11-08 17:05:09

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-14 21:58:28]
  • hack成功,自动添加数据
  • (/hack/1181)
  • [2024-11-08 17:05:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4328kb
  • [2024-11-08 17:05:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
struct point{
	double x,y,rd;
	void in(){scanf("%lf %lf",&x,&y);}
	void out(){printf("%lf %lf\n",x,y);}
	point(double xx=0,double yy=0){x=xx,y=yy;}
	point operator + (const point& a)const{return point(x+a.x,y+a.y);}
	point operator - (const point& a)const{return point(x-a.x,y-a.y);}
	double operator *(const point& a)const{return x*a.x+y*a.y;}
	double operator ^(const point& a)const{return x*a.y-y*a.x;}
	bool operator < (const point& a)const{return rd<a.rd;}
};
double len(const point& a){return sqrt(a*a);}
double rad(const point& a){return atan2(a.y,a.x);}
const int maxn=105;
point p[maxn];
double cal(double t,double l,double r)
{
	double w=(r-l);
	if(w<0) w+=2*pi;
	double ans=(int)(t/(2*pi))*w;
	t-=(int)(t/(2*pi))*2.0*pi;
	if(l<r)
	{	
		return ans+max(0.0,min(t,r)-l);	
	}
	else 
	{
		return ans+max(t-l,0.0)+min(t,r);
	}
}
int main()
{
	//printf("%lf",asin(1/sqrt(5)));
	int n;point s;double d,t;
	scanf("%d",&n);s.in();scanf("%lf %lf",&d,&t);
	for(int i=1;i<=n;i++) p[i].in();
	for(int i=1;i<=n;i++) p[i].rd=rad(p[i]);
	sort(p+1,p+1+n);
	double l,r;
	//printf("%lf %lf \n",p[1].rd,p[n].rd);
	if(p[n].rd-p[1].rd<pi)
	{
		double dl=asin(d/len(p[1]));
		double dr=asin(d/len(p[n]));
		l=p[1].rd-dl;
		r=p[n].rd+dr;
		for(int i=1;i<=n;i++)
		{
			double di=asin(d/len(p[i]));
			l=min(l,p[i].rd-di);
			r=max(r,p[i].rd+di);
		}
	}
	else
	{
		int pos1=n,pos2=1;
		while(p[pos1].rd-p[pos1-1].rd<pi) pos1--;
		pos2=pos1-1;
		double dl=asin(d/len(p[pos1]));
		double dr=asin(d/len(p[pos2]));
		l=p[pos1].rd-dl;
		r=p[pos2].rd+dr;
		for(int i=n;i>=pos1;i--) l=min(l,p[i].rd-asin(d/len(p[i])));
		for(int i=1;i<=pos2;i++) r=max(r,p[i].rd+asin(d/len(p[i])));
		for(int i=1;i<=n;i++)
		{
			double di=asin(d/len(p[i]));
			if(p[i].rd-di>0) l=min(l,p[i].rd-di);
			else r=max(r,p[i].rd-di);
			if(p[i].rd+di>0) l=min(l,p[i].rd+di);
			else r=max(r,p[i].rd+di);
		}
	}
	if(l>=2*pi) l-=2*pi;
	if(r>=2*pi) r-=2*pi;
	if(l<0) l+=2*pi;
	if(r<0) r+=2*pi;
	printf("%.15lf\n",cal(rad(s)+t,l,r)-cal(rad(s),l,r));
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000000000

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796326794897

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475477

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300290388

result:

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

Test #5:

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

input:

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

output:

2499.455171841210813

result:

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