QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#618198#9434. Italian CuisinemasterhuangWA 0ms3768kbC++231.2kb2024-10-06 19:43:222024-10-06 19:43:27

Judging History

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

  • [2024-10-06 19:43:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3768kb
  • [2024-10-06 19:43:22]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define LD long double
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=1e5+5;
int T,n;LD r;
struct comp{LD x,y;}a[N],O;
inline LD p2(LD x){return x*x;}
inline comp operator+(comp A,comp B){return {A.x+B.x,A.y+B.y};}
inline comp operator-(comp A,comp B){return {A.x-B.x,A.y-B.y};}
inline LD operator*(comp A,comp B){return A.x*B.y-A.y*B.x;}
inline LD dis(comp A,comp B){return p2(A.x-B.x)+p2(A.y-B.y);}
inline bool chk(comp A,comp B)
{
	if(A.x==B.x) return fabsl(A.x-O.x)>=r;
	if(A.y==B.y) return fabsl(A.y-O.y)>=r;
	LD k=(A.y-B.y)/(A.x-B.x),b=A.y-k*A.x,_k=-1/k,_b=O.y-_k*O.x;
	LD X=(_b-b)/(k-_k),Y=k*X+b;
	return (LL)dis({X,Y},O)>=r*r;
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>T;
	while(T--)
	{
		cin>>n>>O.x>>O.y>>r;LL ans=0,s=0;
		for(int i=1;i<=n;i++) cin>>a[i].x>>a[i].y,a[i+n]=a[i];
		for(int i=1,j=1;i<=n;i++)
		{
			while(j+1<i+n&&chk(a[i],a[j+1])&&(O-a[i])*(a[j+1]-a[i])<0) s+=fabsl((a[j]-a[i])*(a[j+1]-a[j])),j++;
			ans=max(ans,s);s-=fabsl((a[j]-a[i+1])*(a[i+1]-a[i]));
		}cout<<ans<<"\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

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

output:

286862654137719264

result:

wrong answer 1st numbers differ - expected: '0', found: '286862654137719264'