QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#682546#9434. Italian CuisineLautisticycWA 13ms3948kbC++141.2kb2024-10-27 15:57:152024-10-27 15:57:16

Judging History

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

  • [2024-10-27 15:57:16]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3948kb
  • [2024-10-27 15:57:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
long long cas,n,px[200010],py[200010],poi,xc,yc,rc,ans,now;
long long myabs(long long x)
{
	return x<0?-x:x;
}
long long ara(long long a,long long b,long long c)
{
	long long x=px[b]-px[a],y=py[b]-py[a],xx=px[c]-px[a],yy=py[c]-py[a];
	return myabs(x*yy-xx*y);
}
bool check(long long ori,long long to)
{
	//ax1+by1+c=0
	//ax2+by2+c=0
	//a(x1-x2)+b(y1-y2)=0
	//a=y1-y2,b=x2-x1
	//c=-x1y1+x1y2-x2y1+x1y1h
	long long a=py[ori]-px[to],b=px[to]-px[ori],c=-px[ori]*py[ori]+px[ori]*py[to]-px[to]*py[ori]+px[ori]*py[ori];
	if(fabs(a*xc+b*yc+c)<=rc*sqrt(a*a+b*b))	return 0;
	return (px[ori]-xc)*(py[ori]-py[to])-(py[ori]-yc)*(px[ori]-px[to])<0;
}
int main()
{
	scanf("%lld",&cas);
	while(cas--)
	{
		scanf("%lld %lld %lld %lld",&n,&xc,&yc,&rc);
		for(long long i=1;i<=n;++i)
		{
			scanf("%lld %lld",&px[i],&py[i]);
			px[i+n]=px[i];
			py[i+n]=py[i];
		}
		poi=1;
		ans=0;
		now=0;
		for(long long i=1;i<=n;++i)
		{
			if(i>1)	now-=ara(i-1,i,poi);
			poi=max(poi,i+1);
			while(check(i,poi+1))
			{
				++poi;
				now+=ara(i,poi,poi-1);
			}
			ans=max(ans,now);
		}
		printf("%lld\n",ans);
	}
	return 0;
}

详细

Test #1:

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

input:

3
5
1 1 1
0 0
1 0
5 0
3 3
0 5
6
2 4 1
2 0
4 0
6 3
4 6
2 6
0 3
4
3 3 1
3 0
6 3
3 6
0 3

output:

5
24
0

result:

ok 3 number(s): "5 24 0"

Test #2:

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

input:

1
6
0 0 499999993
197878055 -535013568
696616963 -535013568
696616963 40162440
696616963 499999993
-499999993 499999993
-499999993 -535013568

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: -100
Wrong Answer
time: 13ms
memory: 3824kb

input:

6666
19
-142 -128 26
-172 -74
-188 -86
-199 -157
-200 -172
-199 -186
-195 -200
-175 -197
-161 -188
-144 -177
-127 -162
-107 -144
-90 -126
-87 -116
-86 -104
-89 -97
-108 -86
-125 -80
-142 -74
-162 -72
16
-161 -161 17
-165 -190
-157 -196
-154 -197
-144 -200
-132 -200
-128 -191
-120 -172
-123 -163
-138...

output:

9410
5228
4787
3593
7868
13142
7269
5711
6842
2930
3177
7134
8229
3610
9875
13259
5112
7937
11447
1648
2164
5344
6860
3691
5680
15756
3803
11309
956
2643
5596
9598
6697
9767
13519
9387
1162
6190
11541
6650
6360
7507
5572
5704
1875
3833
4795
12688
7002
1771
10087
1780
4766
7895
2756
7955
4495
6685
20...

result:

wrong answer 1st numbers differ - expected: '5093', found: '9410'