QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#605443#9434. Italian Cuisinecode_side-effectWA 1ms3516kbC++202.3kb2024-10-02 17:16:172024-10-02 17:16:20

Judging History

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

  • [2024-10-02 17:16:20]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3516kb
  • [2024-10-02 17:16:17]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <list>
#include <bitset>
#include <cmath>
#include <numeric>



using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

template <typename T>
inline void read(T &x)
{
    T f = 1;
    x = 0;
    char ch = getchar();
    while (0 == isdigit(ch))
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (0 != isdigit(ch))
        x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
    x *= f;
}

template <typename T>
inline void write(T x)
{
    if (x < 0)
    {
        x = ~(x - 1);
        putchar('-');
    }
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}

typedef __int128_t lll;
typedef pair<lll, lll> P;

#define x first
#define y second

// 叉乘
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()
{
    int n;
    read(n);

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

    lll R;
    read(R);

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

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3516kb

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:

0
24
0

result:

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