QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#834678#21883. Prism Palace (Love Qiwen Xu ver.)CrysflyAC ✓21ms12368kbC++141.3kb2024-12-27 21:28:302024-12-27 21:28:46

Judging History

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

  • [2024-12-27 21:28:46]
  • 评测
  • 测评结果:AC
  • 用时:21ms
  • 内存:12368kb
  • [2024-12-27 21:28:30]
  • 提交

answer

#include <stdio.h>
#include <random>
#include <queue>
#include <time.h>
std::mt19937_64 rng(time(0));
#include <math.h>
#include <time.h>
#include <assert.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#define int long long
#define ld(x) printf("%lld\n",x)
// #define int unsigned
using std::vector;
using vi=vector<int>;
using pi=std::pair<int,int>;
using vpi=vector<pi>;
#define x first
#define y second
const int mod=998244353;
inline int min(int a,int b){return a>b?b:a;}
inline int max(int a,int b){return a<b?b:a;}
inline int read()
{
    int num=0,f=1;char c=getchar();
    while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
    while(c>47&&c<58)num=num*10+(c^48),c=getchar();
    return num*f;
}

typedef int arr[2000005];
int a[1234567],b[1234567];
double c[1234567];
double test(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return acos(((x1-x2)*(x1-x3)+(y1-y2)*(y1-y3))/(hypot(x1-x2,y1-y2)*hypot(x1-x3,y1-y3)));
}
signed main()
{
	int n=read();
	for(int i=0;i<n;i++)a[i]=read(),b[i]=read();
	for(int i=0;i<n;i++)
	{
		c[i]=test(a[(i+1)%n],b[(i+1)%n],a[i],b[i],a[(i+2)%n],b[(i+2)%n]);
		// printf("%.12lf\n",c[i]/acos(-1));
	}
	double res=0,pi=acos(-1);
	for(int i=0;i<n;i++)
		res+=std::max(0.,pi-c[i]-c[(i+1)%n]);
	printf("%.12lf\n",res/pi);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

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: 0ms
memory: 6420kb

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: 0ms
memory: 6500kb

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: 0
Accepted
time: 14ms
memory: 12264kb

input:

199998
-401439104 808964397
-401436126 808965446
-401435185 808965777
-401433632 808966325
-401428358 808968182
-401427134 808968613
-401422823 808970131
-401422094 808970388
-401419626 808971257
-401413017 808973585
-401411225 808974216
-401408435 808975198
-401407425 808975554
-401403924 808976787...

output:

0.000029800321

result:

ok found '0.0000298', expected '0.0000298', error '0.0000000'

Test #5:

score: 0
Accepted
time: 21ms
memory: 12368kb

input:

199998
761493784 -150716309
761496080 -150712499
761496863 -150711200
761497141 -150710739
761497673 -150709856
761498309 -150708801
761498866 -150707877
761502363 -150702075
761504234 -150698970
761505470 -150696920
761505582 -150696735
761505688 -150696560
761506226 -150695667
761507597 -150693392...

output:

0.000052161574

result:

ok found '0.0000522', expected '0.0000522', error '0.0000000'

Test #6:

score: 0
Accepted
time: 19ms
memory: 11972kb

input:

199999
-313772198 -315367193
-313768751 -315370633
-313768062 -315371320
-313766641 -315372739
-313766256 -315373122
-313764203 -315375172
-313756449 -315382911
-313750089 -315389258
-313749240 -315390106
-313746581 -315392760
-313745739 -315393600
-313737746 -315401580
-313733885 -315405433
-313730...

output:

0.000000000000

result:

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

Test #7:

score: 0
Accepted
time: 21ms
memory: 11256kb

input:

199998
-290160652 -194499826
-290161980 -194499251
-290172032 -194494896
-290177477 -194492538
-290183474 -194489940
-290193090 -194485774
-290199951 -194482802
-290205067 -194480585
-290207415 -194479568
-290207541 -194479513
-290217591 -194475159
-290223989 -194472386
-290227374 -194470920
-290233...

output:

0.000000000000

result:

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

Test #8:

score: 0
Accepted
time: 17ms
memory: 12216kb

input:

200000
82162345 681132396
82161738 681129487
82161553 681128603
82161446 681128088
82160863 681125297
82160735 681124683
82160536 681123729
82159538 681118953
82159394 681118266
82159320 681117910
82159160 681117142
82158780 681115324
82158587 681114399
82158229 681112685
82157954 681111371
82157865...

output:

0.000000000000

result:

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