QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#552177#9253. Prism Palaceucup-team4508#WA 125ms8148kbC++141.1kb2024-09-07 20:57:342024-09-07 20:57:35

Judging History

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

  • [2024-09-07 20:57:35]
  • 评测
  • 测评结果:WA
  • 用时:125ms
  • 内存:8148kb
  • [2024-09-07 20:57:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define LL long long
struct Point{
	double x,y;
}p[500005],a[500005];
struct Vector{
	double x,y;
};
Vector operator -(const Point &x,const Point &y){
	return {x.x-y.x,x.y-y.y};
}
LL n,i,j,k,m,t;
double ans=0;
LL sum1=0,sum2=0;
Point get(Point x1,Point x2,Point y1,Point y2){
	double k1=(x2.y-x1.y)/(x2.x-x1.x),k2=(y2.y-y1.y)/(y2.x-y1.x);
	double b1=x1.y-k1*x1.x,b2=y1.y-k2*y1.x;
	double ansx=(b2-b1)/(k1-k2);
	double ansy=k1*ansx+b1;
	return {ansx,ansy};
}
int main(){
	cin>>n;
	for(i=1;i<=n;i++)
	  cin>>p[i].x>>p[i].y;
	for(i=1;i<=n;i++){
		LL l1=i-1,r1=i+2,x=i+1;
		if(l1==0) l1=n;
		if(r1>n) r1%=n;
		if(x>n) x%=n;
		Vector tmp1=p[i]-p[l1],tmp2=p[x]-p[r1];
		if(tmp1.y/tmp1.x!=tmp2.y/tmp2.x){
			Point tmp=get(p[i],p[l1],p[x],p[r1]);
			if((tmp.x>=p[i].x && p[i].x>=p[l1].x) || (tmp.x<=p[i].x && p[i].x<=p[l1].x)) continue;
		}
		double num=abs(atan(tmp1.y*1.0/tmp1.x)-atan(tmp2.y*1.0/tmp2.x));
		ans+=num;
		//printf("%lld %.12lf\n",i,ans/4/asin(1.0/sqrt(2)));
	}
	printf("%.12lf",ans/4/asin(1.0/sqrt(2)));
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
0 0
1 0
0 1

output:

1.000000000000

result:

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

Test #2:

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

input:

4
0 0
0 1
1 1
1 0

output:

0.000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #3:

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

input:

4
0 0
0 3
1 2
1 1

output:

0.500000000000

result:

ok found '0.5000000', expected '0.5000000', error '0.0000000'

Test #4:

score: -100
Wrong Answer
time: 125ms
memory: 8148kb

input:

199996
719157942 80035870
719158808 80033199
719160795 80027070
719162868 80020675
719165635 80012139
719166422 80009711
719166927 80008153
719168388 80003645
719168539 80003179
719168806 80002355
719168864 80002176
719169119 80001389
719171067 79995376
719173806 79986921
719175195 79982633
71917686...

output:

0.999922283197

result:

wrong answer 1st numbers differ - expected: '0.0000777', found: '0.9999223', error = '0.9998446'