QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#873066#9434. Italian CuisineGodwangRE 0ms0kbC++232.0kb2025-01-26 08:28:262025-01-26 08:28:31

Judging History

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

  • [2025-01-26 08:28:31]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2025-01-26 08:28:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define lll __int128

typedef pair<lll, lll> P;

#define x first
#define y second

/////////////////
inline void read(__int128 &xx)
{
    bool flag = false;
    xx = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            flag = true;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        xx = (xx << 1) + (xx << 3) + ch - '0';
        ch = getchar();
    }
}
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()
{
    freopen("ain.txt", "r", stdin);
    freopen("aout.txt", "w", stdout);
    lll n;
    read(n);

    P C;
    read(C.x);
    read(C.y);

    lll R;
    read(R);

    vector<P> a(n + 5);
    for (int i = 1; i <= n; i++)
    {
        read(a[i].x);
        read(a[i].y);
    }
    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);
    lll _ = 1;
    // std::cin >> _;
    read(_);
    while (_--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

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

output:


result: