QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#741018 | #9434. Italian Cuisine | xsdgp | WA | 14ms | 3692kb | C++20 | 1.4kb | 2024-11-13 12:58:56 | 2024-11-13 12:58:57 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
int n,r;
struct VECTOR
{
int x,y;
int operator*(const VECTOR &v)const
{
return x*v.x+y*v.y;
}
int operator^(const VECTOR &v)const
{
return x*v.y-y*v.x;
}
};
struct POINT
{
int x,y;
VECTOR operator-(const POINT &p)const
{
return {x-p.x,y-p.y};
}
}p[2005],p0,o={0,0};
bool check(POINT p1,POINT p2)
{
VECTOR v1=p2-p1,v2=p0-p1;
if((v1^v2)<=0)return 0;
return ((__int128)(v1^v2))*(v1^v2)>=((__int128)(v1*v1))*r*r;
}
void solve()
{
cin>>n;
cin>>p0.x>>p0.y>>r;
for(int i=0;i<n;i++)
cin>>p[i].x>>p[i].y;
int sum=0;
for(int i=0;i<n;i++)
sum+=((p[i]-o)^(p[(i+1)%n]-o));
int j=0,area=0,ans=0;
for(int i=0;i<n;i++)
{
while(check(p[i],p[(j+1)%n]))
{
j=(j+1)%n;
VECTOR v1=p[j]-p[(j-1+n)%n],v2=p[i]-p[(j-1+n)%n];
area+=abs((v1^v2));
if(((p[i]-p[(i-1+n)%n])^(p[(i+1)%n]-p[i]))==0)continue;
if(((p[j]-p[(j-1+n)%n])^(p[(j+1)%n]-p[j]))==0)continue;
ans=max(ans,area);
}
VECTOR v1=p[(i+1)%n]-p[i],v2=p[j]-p[i];
area-=abs((v1^v2));
}
cout<<ans<<endl;
}
signed main()
{
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int T=1;
cin>>T;
while(T--)solve();
return 0;
}
/*
1
6
0 0 499999993
197878055 -535013568
696616963 -535013568
696616963 40162440
696616963 499999993
-499999993 499999993
-499999993 -535013568
1
4
3 2 1
3 0
6 3
3 6
0 3
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
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: 3548kb
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: 14ms
memory: 3692kb
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:
5093 3086 2539 668 3535 7421 4883 5711 5624 1034 2479 3920 4372 2044 4996 4569 2251 4382 4175 1489 1154 3231 4038 1631 5086 14444 1692 6066 687 1512 4849 5456 2675 8341 8557 8235 1013 5203 10853 6042 6300 4480 2303 2728 1739 2187 3385 4266 6322 909 4334 1518 948 5036 1449 2376 3180 4810 1443 1786 46...
result:
wrong answer 16th numbers differ - expected: '5070', found: '4569'