QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#604143#9434. Italian CuisineSound_MediumCompile Error//C++231.9kb2024-10-01 23:48:112024-10-01 23:48:12

Judging History

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

  • [2024-10-01 23:48:12]
  • 评测
  • [2024-10-01 23:48:11]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
// #define intlong double
using namespace std;
const int N=2e5+10;
int n;
int x,y,r;
struct Point{
    int x,y;
    Point(){}
    Point(int xx,int yy){
        x=xx,y=yy;
    }
    Point operator+(const Point &o)const{
        return Point(x+o.x,y+o.y);
    }
    Point operator-(const Point &o)const{
        return Point(x-o.x,y-o.y);
    }
    int operator*(const Point&o)const{
        return x*o.x+y*o.y;
    }
    int operator^(const Point&o)const{
        return x*o.y-y*o.x;
    }
    bool operator<(const Point&o)const{
        if(x!=o.x)return x<o.x;
        return y<o.y;
    }
}p[N],st[N];
bool check(Point x,Point a,Point b){
    Point v1=b-a,v2=x-a;
    __int128 k=v1^v2;
    __int128 L=(v1*v1);
    k=abs(k);
    // cerr<<k<<endl;
    // cerr<<r<<endl;
    if(k*k>r*r*L){
        return 1;
    }
    else return 0;
}
void solve () {
    cin>>n;
    cin>>x>>y>>r;
    p[0]={x,y};
    for(int i=1;i<=n;i++){
        int x,y;
        cin>>x>>y;
        p[i]=p[n+i]={x,y};
    }
    int maxx=0,res;
    vector<int>pre(2*n+2,0);
    for(int i=2;i<=2*n;i++){
        pre[i]=pre[i-1]+(p[i-1]^p[i]);
    }
    auto f=[&](int st,int ed)->bool {
        {}
        if(((p[ed]-p[st])^(p[0]-p[st]))>0&&check(p[0],p[st],p[ed])){
            return 1;
        }
        return 0;
    };
    for(int i=1;i<=n;i++){
        int l=i+1,r=n+i-1;
        while(l<r){
            int mid=l+r+1>>1;
            if(f(i,mid))l=mid;
            else r=mid-1;
        }
        // cerr<<i<<" "<<l<<" "<<abs(pre[l]-pre[i]+(p[l]*p[i]))<<endl;
        maxx=max(maxx,abs(pre[l]-pre[i]+(p[l]^p[i])));
    }
    cout<<maxx<<'\n';
}

signed main () {
    ios::sync_with_stdio (false);
    cin.tie (nullptr);

    int T = 1;
    cin >> T;

    while (T --) {
        solve ();
    }

    return 0;
}

詳細信息

answer.code: In function ‘bool check(Point, Point, Point)’:
answer.code:35:10: error: call of overloaded ‘abs(__int128&)’ is ambiguous
   35 |     k=abs(k);
      |       ~~~^~~
In file included from /usr/include/c++/13/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:42,
                 from answer.code:1:
/usr/include/stdlib.h:840:12: note: candidate: ‘int abs(int)’
  840 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/13/cstdlib:81:
/usr/include/c++/13/bits/std_abs.h:130:3: note: candidate: ‘constexpr __gnu_cxx::__bfloat16_t std::abs(__gnu_cxx::__bfloat16_t)’
  130 |   abs(__gnu_cxx::__bfloat16_t __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:124:3: note: candidate: ‘constexpr _Float128 std::abs(_Float128)’
  124 |   abs(_Float128 __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:114:3: note: candidate: ‘constexpr _Float64 std::abs(_Float64)’
  114 |   abs(_Float64 __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:108:3: note: candidate: ‘constexpr _Float32 std::abs(_Float32)’
  108 |   abs(_Float32 __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:102:3: note: candidate: ‘constexpr _Float16 std::abs(_Float16)’
  102 |   abs(_Float16 __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:79:3: note: candidate: ‘constexpr long double std::abs(long double)’
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:75:3: note: candidate: ‘constexpr float std::abs(float)’
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:71:3: note: candidate: ‘constexpr double std::abs(double)’
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~