QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#873071 | #9434. Italian Cuisine | Godwang | RE | 0ms | 0kb | C++23 | 1.9kb | 2025-01-26 08:38:08 | 2025-01-26 08:38:10 |
answer
#include <bits/stdc++.h>
using namespace std;
#define lll __int128
typedef pair<lll, lll> P;
#define x first
#define y second
/////////////////
inline lll read()
{
lll x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch-'0',ch=getchar();
return x*f;
}
inline void write(lll xx)
{
if (xx > 9)
{
write(xx / 10);
}
putchar(xx % 10 + 48);
}
/////////////////
lll cross(P a, P b)
{
return a.x * b.y - a.y * b.x;
}
lll mul(P a, P b)
{
return a.x * b.x + a.y * b.y;
}
lll mul(P a)
{
return a.x * a.x + a.y * a.y;
}
P del(P a, P b)
{
return {a.x - b.x, a.y - b.y};
}
void solve()
{
lll n;
n=read();
P C;
C.x=read();
C.y=read();
lll R;
R=read();
vector<P> a(n + 5);
for (int i = 1; i <= n; i++)
{
a[i].x=read();
a[i].y=read();
}
lll ans = 0;
lll S = 0;
for (int l = 1, r = l + 1; l <= n; l++)
{
while (1)
{
int rr = r % n + 1;
lll s = cross(del(a[rr], a[l]), del(C, a[l]));
if (s <= 0)
break;
if (s * s < mul(del(a[rr], a[l])) * R * R)
break;
S += cross(del(a[r], a[l]), del(a[rr], a[l]));
r = rr;
}
ans = max(ans, S);
int ll = l % n + 1;
S -= cross(del(a[r], a[l]), del(a[r], a[ll]));
}
write(ans);
putchar('\n');
}
int main()
{
// ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
freopen("ain.txt", "r", stdin);
freopen("aout.txt", "w", stdout);
lll _ = 1;
// std::cin >> _;
_=read();
while (_--)
{
solve();
}
return 0;
}
详细
Test #1:
score: 0
Dangerous Syscalls
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