QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#617117 | #9434. Italian Cuisine | zzpcd# | WA | 13ms | 7772kb | C++20 | 1.5kb | 2024-10-06 13:58:07 | 2024-10-06 13:58:10 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define N 200010
using namespace std;
int T;
int x[N],y[N];
int X,Y,R,n;
class line{
public:
int x,y;
friend int operator * (line a,line b)
{
return a.x*b.x+a.y*b.y;
}
friend line operator - (line a,line b)
{
return line{b.x-a.x,b.y-a.y};
}
}s[N];
int len(line a)
{
return a.x*a.x+a.y*a.y;
}
int val(line a,line b)
{
return (a.x*b.y-a.y*b.x);
}
int opt(int x)
{
if(x<0) return -1;
if(x==0) return 0;
if(x>0) return 1;
}
bool check(int l,int r)
{
if(opt(val(s[r]-s[l],s[0]-s[l]))!=1) return false;
__int128 a=1;
if(a*val(s[r]-s[l],s[0]-s[l])*val(s[r]-s[l],s[0]-s[l])<a*len(s[r]-s[l])*R*R) return false;
return true;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>T;
while(T--)
{
cin>>n;
cin>>X>>Y>>R;
s[0]={X,Y};
for(int i=1;i<=n;++i)
{
cin>>x[i]>>y[i];
s[i].x=x[i],s[i].y=y[i];
s[i+n]=s[n];
x[i+n]=x[i],y[i+n]=y[i];
}
int l=1,r=1,res=0,now=0;
while(l<=n)
{
while(r+1<=2*n&&check(l,r+1))
{
now+=abs(val(s[r]-s[l],s[r+1]-s[l]));
++r;
}
res=max(res,now);
++l;
now-=abs(val(s[l]-s[l-1],s[r]-s[l-1]));
}
cout<<res<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5564kb
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: 7772kb
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: 5580kb
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:
30626 3086 1753 668 3535 7421 4883 6271 8262 1034 6378 3777 4372 3744 4996 5070 4213 3225 4175 1489 1104 9897 4038 1631 5086 19414 2836 11270 2355 1512 3548 5097 2757 6599 8073 9904 4148 7864 9576 5655 5412 4480 2303 2728 1431 2187 6287 4266 5206 901 4334 1518 948 6964 1449 2376 4014 4810 1443 1478 ...
result:
wrong answer 1st numbers differ - expected: '5093', found: '30626'