QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#680576#9434. Italian CuisineyueyueyCompile Error//C++231.3kb2024-10-26 21:36:442024-10-26 21:36:45

Judging History

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

  • [2024-10-26 21:36:45]
  • 评测
  • [2024-10-26 21:36:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6+10;
const ld eps = 1e-6;
typedef int lll;

#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;
    cin>>n;
    P C;
    cin>>C.x;
    cin>>C.y;

    lll R;
    cin>>R;

    vector<P> a(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i].x;
        cin>>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]));
    }
    cout<<ans<<"\n";
}

signed main(){
    int _ = 1;
    cin>>_;
    while (_--)
    {
        solve();
    }
    return 0;
}

Details

answer.code:5:7: error: ‘ld’ does not name a type
    5 | const ld eps = 1e-6;
      |       ^~
answer.code:12:11: error: ‘P’ was not declared in this scope
   12 | lll cross(P a, P b)
      |           ^
answer.code:12:16: error: ‘P’ was not declared in this scope
   12 | lll cross(P a, P b)
      |                ^
answer.code:12:19: error: expression list treated as compound expression in initializer [-fpermissive]
   12 | lll cross(P a, P b)
      |                   ^
answer.code:18:9: error: ‘P’ was not declared in this scope
   18 | lll mul(P a, P b)
      |         ^
answer.code:18:14: error: ‘P’ was not declared in this scope
   18 | lll mul(P a, P b)
      |              ^
answer.code:18:17: error: expression list treated as compound expression in initializer [-fpermissive]
   18 | lll mul(P a, P b)
      |                 ^
answer.code:24:5: error: redefinition of ‘lll mul’
   24 | lll mul(P a)
      |     ^~~
answer.code:18:5: note: ‘lll mul’ previously defined here
   18 | lll mul(P a, P b)
      |     ^~~
answer.code:24:9: error: ‘P’ was not declared in this scope
   24 | lll mul(P a)
      |         ^
answer.code:30:1: error: ‘P’ does not name a type
   30 | P del(P a, P b)
      | ^
answer.code: In function ‘void solve()’:
answer.code:39:5: error: ‘P’ was not declared in this scope
   39 |     P C;
      |     ^
answer.code:40:10: error: ‘C’ was not declared in this scope
   40 |     cin>>C.x;
      |          ^
answer.code:46:13: error: template argument 2 is invalid
   46 |     vector<P> a(n);
      |             ^
answer.code:49:15: error: invalid types ‘int[long long int]’ for array subscript
   49 |         cin>>a[i].x;
      |               ^
answer.code:50:15: error: invalid types ‘int[long long int]’ for array subscript
   50 |         cin>>a[i].y;
      |               ^
answer.code:59:32: error: invalid types ‘int[long long int]’ for array subscript
   59 |             lll s = cross(del(a[rr], a[l]), del(C, a[l]));
      |                                ^
answer.code:59:39: error: invalid types ‘int[long long int]’ for array subscript
   59 |             lll s = cross(del(a[rr], a[l]), del(C, a[l]));
      |                                       ^
answer.code:59:27: error: ‘del’ was not declared in this scope
   59 |             lll s = cross(del(a[rr], a[l]), del(C, a[l]));
      |                           ^~~
answer.code:59:53: error: invalid types ‘int[long long int]’ for array subscript
   59 |             lll s = cross(del(a[rr], a[l]), del(C, a[l]));
      |                                                     ^
answer.code:59:57: error: ‘cross’ cannot be used as a function
   59 |             lll s = cross(del(a[rr], a[l]), del(C, a[l]));
      |                                                         ^
answer.code:62:34: error: invalid types ‘int[long long int]’ for array subscript
   62 |             if (s * s < mul(del(a[rr], a[l])) * R * R)
      |                                  ^
answer.code:62:41: error: invalid types ‘int[long long int]’ for array subscript
   62 |             if (s * s < mul(del(a[rr], a[l])) * R * R)
      |                                         ^
answer.code:62:45: error: ‘mul’ cannot be used as a function
   62 |             if (s * s < mul(del(a[rr], a[l])) * R * R)
      |                                             ^
answer.code:64:29: error: invalid types ‘int[long long int]’ for array subscript
   64 |             S += cross(del(a[r], a[l]), del(a[rr], a[l]));
      |                             ^
answer.code:64:35: error: invalid types ‘int[long long int]’ for array subscript
   64 |             S += cross(del(a[r], a[l]), del(a[rr], a[l]));
      |                                   ^
answer.code:64:46: error: invalid types ‘int[long long int]’ for array subscript
   64 |             S += cross(del(a[r], a[l]), del(a[rr], a[l]));
      |                                              ^
answer.code:64:53: error: invalid types ‘int[long long int]’ for array subscript
   64 |             S += cross(del(a[r], a[l]), del(a[rr], a[l]));
      |                                                     ^
answer.code:64:57: error: ‘cross’ cannot be used as a function
   64 |             S += cross(del(a[r], a[l]), del(a[rr], a[l]));
      |                                                         ^
answer.code:69:25: error: invalid types ‘int[long long int]’ for array subscript
   69 |         S -= cross(del(a[r], a[l]), del(a[r], a[ll]));
      |                         ^
answer.code:69:31: error: invalid types ‘int[long long int]’ for array subscript
   69 |         S -= cross(del(a[r], a[l]), del(a[r], a[ll]));
      |                               ^
answer.code:69:20: error: ‘del’ was not declared in this scope
   69 |         S -= cross(del(a[r], a[l]), del(a[r], a[ll]));
      |                    ^~~
answer.code:69:42: error: invalid types ‘int[long long int]’ for array subscript
   69 |         S -= cross(del(a[r], a[l]), del(a[r], a[ll]));
     ...