QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#873117 | #9434. Italian Cuisine | Godwang | Compile Error | / | / | C++23 | 5.7kb | 2025-01-26 09:34:35 | 2025-01-26 09:34:35 |
Judging History
This is the latest submission verdict.
- [2025-01-26 09:34:35]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-26 09:34:35]
- Submitted
answer
#include <iostream>
using namespace std;
#include <set>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <string>
#include <cstring>
#include <string.h>
#include <stdlib.h>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <ctype.h>
#include <vector>
#include <random>
#include<list>
#define double __int128
#define ll __int128
#define ull unsigned long long
#define pb push_back
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = n; i >= a; i--)
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define lowbit(x) ((x)&(-x))
ll extend_gcd(ll a, ll b, ll &x, ll &y)
{
if (b == 0)
{
x = 1;
y = 0;
return a;
}
ll d = extend_gcd(b, a % b, y, x);
y -= a / b * x;
return d;
}
ll fastpow(ll a, ll n, ll mod)
{
ll ans = 1;
a %= mod;
while (n)
{
if (n & 1)
ans = (ans * a) % mod; //% mod
a = (a * a) % mod; //% mod
n >>= 1;
}
return ans;
}
inline void write(__int128 x)
{
if (x > 9)
{
write(x / 10);
}
putchar(x % 10 + '0');
}
__int128 sqrt(__int128 m)
{
__int128 leftt = 0, rightt = ((__int128)1) << 51, ret = -1, mid;
while (leftt < rightt)
{
mid = (leftt + rightt) / 2;
if (mid * mid > m)
{
rightt = mid;
}
else
{
leftt = mid + 1;
ret = mid;
}
}
return ret;
}
const double eps = 1e-6;
int sgn(double x)
{
if(fabs(x)<eps)
{
return 0;
}
else return x<0?-1:1;
}
struct Point
{
double x,y;
Point()
{
}
Point(double x,double y):x(x),y(y)
{
}
Point operator + (Point B)
{
return Point(x+B.x,y+B.y);
}
Point operator - (Point B)
{
return Point(x-B.x,y-B.y);
}
bool operator == (Point B)
{
return sgn(x-B.x)==0&&sgn(y-B.y)==0;
}
bool operator < (Point B)
{
return sgn(x-B.x)<0||(sgn(x-B.x)==0&&sgn(y-B.y)<0);
}
};
typedef Point Vector;
double Cross(Vector A,Vector B)//叉积
{
return A.x*B.y-A.y*B.x;
}
double Distance(Point A,Point B)
{
return hypot(A.x-B.x,A.y-B.y);
}
int Convex_hull(Point *p,int n,Point *ch)
{
n=unique(p,p+n)-p;
sort(p,p+n);
int v=0;
for(int i=0;i<n;i++)
{
while (v>1&&sgn(Cross(ch[v-1]-ch[v-2],p[i]-ch[v-1]))<=0)
{
v--;
}
ch[v++]=p[i];
}
int j=v;
for(int i=n-2;i>=0;i--)
{
while (v>j&&sgn(Cross(ch[v-1]-ch[v-2],p[i]-ch[v-1]))<=0)
{
v--;
}
ch[v++]=p[i];
}
if(n>1)
{
v--;
}
return v;
}
int kmp(string s, string p)
{
int ans = 0, lastt = -1;
int lenp = p.size();
vector<int > Next(lenp+3,0);
rep(i, 1, lenp - 1)
{
int j = Next[i];
while (j && p[j] != p[i])
{
j = Next[j];
}
if (p[j] == p[i])
{
Next[i + 1] = j + 1;
}
else
{
Next[i + 1] = 0;
}
}
int lens = s.size();
int j = 0;
rep(i, 0, lens - 1)
{
while (j && s[i] != p[j])
{
j = Next[j];
}
if (s[i] == p[j])
{
j++;
}
if (j == lenp)
{
ans++;
}
}
return ans;
}
int dir[4][2] =
{
{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // 左右上下
// int dir[8][2]={
// {-1, 0}, {0, 1}, {1, 0}, {0, -1},{-1,-1},{-1,1},{1,-1},{1,1}
// };
const ll inf = LONG_LONG_MAX;
const ll mod1 = 998244353ll, P1 = 131, mod2 = 1e9 + 7ll, P2 = 13331;
ll inverse(ll x)
{
return fastpow(x,mod1-2,mod1);
}
const int N = 1e6 + 10, M = 1e6 + 10;
///////////////////////////////////
int tt;
int n;
Point p[N],ch[N],c;
ll R;
///////////////////////////////////
inline ll read()
{
ll 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;
}
///////////////////////////////////
void init()
{
}
///////////////////////////////////
int main()
{
// freopen("ain.txt", "r", stdin); freopen("aout.txt", "w", stdout);
cin>>tt;
while (tt--)
{
n=read();
c.x=read();
c.y=read();
R=read();
rep(i,0,n-1)
{
p[i].x=read();
p[i].y=read();
}
int v=Convex_hull(p,n,ch);
ll ans=0;
int r=1,rr=2;
ll S=0;
rep(leftt,0,v-1)
{
while (1)
{
rr=(r+1)%v;
ll temp=Cross(c-ch[rr],ch[leftt]-ch[rr]);
if(temp<0)
{
break;
}
ll dis=(ch[leftt].x-ch[rr].x)*(ch[leftt].x-ch[rr].x)+(ch[leftt].y-ch[rr].y)*(ch[leftt].y-ch[rr].y);
if(Cross(ch[leftt]-ch[rr],c-ch[rr])*Cross(ch[leftt]-ch[rr],c-ch[rr])<dis*R*R)
{
break;
}
S+=Cross(ch[leftt]-ch[rr],ch[r]-ch[rr]);
ans=max(ans,S);
r=rr;
}
int nxtleftt=(leftt+1)%v;
S-=Cross(ch[leftt]-ch[r],ch[nxtleftt]-ch[r]);
}
write(ans);
putchar('\n');
}
return 0;
}
Details
answer.code: In function ‘int sgn(__int128)’: answer.code:88:12: error: call of overloaded ‘fabs(__int128&)’ is ambiguous 88 | if(fabs(x)<eps) | ~~~~^~~ In file included from /usr/include/features.h:502, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:680, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:162:1: note: candidate: ‘double fabs(double)’ 162 | __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~ In file included from answer.code:5: /usr/include/c++/14/cmath:993:3: note: candidate: ‘constexpr __gnu_cxx::__bfloat16_t std::fabs(__gnu_cxx::__bfloat16_t)’ 993 | fabs(__gnu_cxx::__bfloat16_t __x) | ^~~~ /usr/include/c++/14/cmath:903:3: note: candidate: ‘constexpr _Float128 std::fabs(_Float128)’ 903 | fabs(_Float128 __x) | ^~~~ /usr/include/c++/14/cmath:717:3: note: candidate: ‘constexpr _Float64 std::fabs(_Float64)’ 717 | fabs(_Float64 __x) | ^~~~ /usr/include/c++/14/cmath:623:3: note: candidate: ‘constexpr _Float32 std::fabs(_Float32)’ 623 | fabs(_Float32 __x) | ^~~~ /usr/include/c++/14/cmath:529:3: note: candidate: ‘constexpr _Float16 std::fabs(_Float16)’ 529 | fabs(_Float16 __x) | ^~~~ /usr/include/c++/14/cmath:242:3: note: candidate: ‘constexpr long double std::fabs(long double)’ 242 | fabs(long double __x) | ^~~~ /usr/include/c++/14/cmath:238:3: note: candidate: ‘constexpr float std::fabs(float)’ 238 | fabs(float __x) | ^~~~ answer.code: In function ‘__int128 Distance(Point, Point)’: answer.code:130:17: error: call of overloaded ‘hypot(__int128, __int128)’ is ambiguous 130 | return hypot(A.x-B.x,A.y-B.y); | ~~~~~^~~~~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:147:1: note: candidate: ‘double hypot(double, double)’ 147 | __MATHCALL_VEC (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ /usr/include/c++/14/cmath:3547:3: note: candidate: ‘constexpr __gnu_cxx::__bfloat16_t std::hypot(__gnu_cxx::__bfloat16_t, __gnu_cxx::__bfloat16_t)’ 3547 | hypot(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | ^~~~~ /usr/include/c++/14/cmath:3412:3: note: candidate: ‘constexpr _Float128 std::hypot(_Float128, _Float128)’ 3412 | hypot(_Float128 __x, _Float128 __y) | ^~~~~ /usr/include/c++/14/cmath:3144:3: note: candidate: ‘constexpr _Float64 std::hypot(_Float64, _Float64)’ 3144 | hypot(_Float64 __x, _Float64 __y) | ^~~~~ /usr/include/c++/14/cmath:3009:3: note: candidate: ‘constexpr _Float32 std::hypot(_Float32, _Float32)’ 3009 | hypot(_Float32 __x, _Float32 __y) | ^~~~~ /usr/include/c++/14/cmath:2829:3: note: candidate: ‘constexpr _Float16 std::hypot(_Float16, _Float16)’ 2829 | hypot(_Float16 __x, _Float16 __y) | ^~~~~ /usr/include/c++/14/cmath:2433:3: note: candidate: ‘constexpr long double std::hypot(long double, long double)’ 2433 | hypot(long double __x, long double __y) | ^~~~~ /usr/include/c++/14/cmath:2429:3: note: candidate: ‘constexpr float std::hypot(float, float)’ 2429 | hypot(float __x, float __y) | ^~~~~ answer.code: At global scope: answer.code:212:16: error: ‘LONG_LONG_MAX’ was not declared in this scope 212 | const ll inf = LONG_LONG_MAX; | ^~~~~~~~~~~~~ answer.code: In function ‘int sgn(__int128)’: answer.code:93:1: warning: control reaches end of non-void function [-Wreturn-type] 93 | } | ^