QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#744421 | #9520. Concave Hull | zzuqy | Compile Error | / | / | C++14 | 2.9kb | 2024-11-13 21:52:18 | 2024-11-13 21:52:22 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define db double
#define INF 1100000000
#define inf 100000000000000000ll
#define ldb long double
#define pb push_back
#define put_(x) printf("%d ",x)
#define putl_(x) printf("%lld ",x)
#define get(x) x=read()
#define putl(x) printf("%lld\n",x)
#define rep(p,n,i) for(int i=p;i<=n;i+=1)
#define fep(n,p,i) for(int i=n;i>=p;--i)
#define go(x) for(int i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define pii pair<int,int>
#define mk make_pair
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define ui unsigned
#define sq sqrt
#define l(w) t[w].l
#define r(w) t[w].r
#define x(w) t[w].x
#define tag(w) t[w].tag
#define sum(w) t[w].sum
#define sc(A) scanf("%d",&A)
#define scl(A) scanf("%lld",&A)
#define scs(A) scanf("%s",A);
#define put(A) printf("%d\n",A)
#define min(x,y) (x>=y?y:x)
#define max(x,y) (x>=y?x:y)
#define sub(x,y) (x-y<0?x-y+mod:x-y)
#define uint unsigned int
#define mod 1000000007
#define zz p<<1
using namespace std;
int T;
int n,top;
const int MAXN=100010;
struct wy
{
ll x,y;
wy operator +(wy a){return wy(x+a.x,y+a.y);}
wy operator -(wy a){return wy{x-a.x,y-a.y};}
wy operator -(){return wy(-x,-y);}
ll operator *(wy a){return x*a.x+y*a.y;}
int friend operator %(wy a,wy b){return a.x*b.y-a.y*b.x;}
ll operator <(wy a){return y==a.y?x<a.x:y<a.y;}
ll operator ~(){return x*x+y*y;}
}a[MAXN],LTL,g[MAXN],v[MAXN];
int para(wy a,wy b){return a%b==0;}
int Toleft(wy a,wy b){return a%b>0;}
int cmpltl(wy a,wy b){return para(a=a-LTL,b=b-LTL)?~a<~b:a%b>0;}
int s[MAXN];
void Put(wy a){cout<<a.x<<' '<<a.y<<endl;}
int main()
{
sc(T);
while(T--)
{
sc(n);
rep(1,n,i)
{
int x,y;
sc(x);sc(y);
a[i]=wy(x,y);
}
LTL=*min_element(a+1,a+1+n);
//Put(LTL);
sort(a+1,a+1+n,cmpltl);
//rep(1,n,i)Put(a[i]);
//cout<<endl;
//Put(a[2]-LTL);
//Put(a[3]-LTL);
//cout<<(a[2]-LTL)%(a[3]-LTL)<<endl;
//cout<<Toleft(a[2]-LTL,a[3]-LTL)<<endl;
//cout<<cmpltl(a[2],a[3])<<endl;
top=0;
rep(1,n,i)
{
while(top>1&&Toleft(a[i]-a[s[top-1]],a[s[top]]-a[s[top-1]]))--top;
s[++top]=i;
}
if(top<=2||top==n)
{
puts("-1");
continue;
}
//rep(1,top,i)Put(a[s[i]]);
//put(top);
int cnt=0,ww=1;
rep(1,n,i)
{
if(s[ww]==i)
{
++ww;
continue;
}
g[++cnt]=a[i];
}
//put(cnt);
LTL=*min_element(g+1,g+1+cnt);
sort(g+1,g+1+cnt,cmpltl);
int top1=0;
rep(1,cnt,i)
{
while(top1>1&&Toleft(g[i]-v[top1-1],v[top1]-v[top1-1]))--top1;
v[++top1]=g[i];
}
ll ans=0;
rep(2,top-1,i)
{
ans+=(a[s[i]]-a[s[1]])%(a[s[i+1]]-a[s[1]]);
}
//putl(ans);
s[++top]=s[1];v[++top1]=v[1];
ll cc=ans;
ww=1;
rep(1,top-1,i)
{
while(1)
{
cc=min(cc,(a[s[i]]-a[s[i-1]])%(v[ww]-a[s[i-1]]));
if(ww==top1)break;
if((a[s[i]]-a[s[i-1]])%(v[ww]-v[ww-1])>0)break;
++ww;
}
}
putl(cc==0?-1:ans-cc);
}
}
Details
answer.code: In member function ‘wy wy::operator+(wy)’: answer.code:43:50: error: no matching function for call to ‘wy::wy(long long int, long long int)’ 43 | wy operator +(wy a){return wy(x+a.x,y+a.y);} | ^ answer.code:40:8: note: candidate: ‘wy::wy()’ 40 | struct wy | ^~ answer.code:40:8: note: candidate expects 0 arguments, 2 provided answer.code:40:8: note: candidate: ‘constexpr wy::wy(const wy&)’ answer.code:40:8: note: candidate expects 1 argument, 2 provided answer.code:40:8: note: candidate: ‘constexpr wy::wy(wy&&)’ answer.code:40:8: note: candidate expects 1 argument, 2 provided answer.code: In member function ‘wy wy::operator-()’: answer.code:45:40: error: no matching function for call to ‘wy::wy(long long int, long long int)’ 45 | wy operator -(){return wy(-x,-y);} | ^ answer.code:40:8: note: candidate: ‘wy::wy()’ 40 | struct wy | ^~ answer.code:40:8: note: candidate expects 0 arguments, 2 provided answer.code:40:8: note: candidate: ‘constexpr wy::wy(const wy&)’ answer.code:40:8: note: candidate expects 1 argument, 2 provided answer.code:40:8: note: candidate: ‘constexpr wy::wy(wy&&)’ answer.code:40:8: note: candidate expects 1 argument, 2 provided answer.code: In function ‘int main()’: answer.code:66:36: error: no matching function for call to ‘wy::wy(int&, int&)’ 66 | a[i]=wy(x,y); | ^ answer.code:40:8: note: candidate: ‘wy::wy()’ 40 | struct wy | ^~ answer.code:40:8: note: candidate expects 0 arguments, 2 provided answer.code:40:8: note: candidate: ‘constexpr wy::wy(const wy&)’ answer.code:40:8: note: candidate expects 1 argument, 2 provided answer.code:40:8: note: candidate: ‘constexpr wy::wy(wy&&)’ answer.code:40:8: note: candidate expects 1 argument, 2 provided answer.code:26:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | #define sc(A) scanf("%d",&A) | ~~~~~^~~~~~~~~ answer.code:58:9: note: in expansion of macro ‘sc’ 58 | sc(T); | ^~ answer.code:26:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | #define sc(A) scanf("%d",&A) | ~~~~~^~~~~~~~~ answer.code:61:17: note: in expansion of macro ‘sc’ 61 | sc(n); | ^~ answer.code:26:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | #define sc(A) scanf("%d",&A) | ~~~~~^~~~~~~~~ answer.code:65:25: note: in expansion of macro ‘sc’ 65 | sc(x);sc(y); | ^~ answer.code:26:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | #define sc(A) scanf("%d",&A) | ~~~~~^~~~~~~~~ answer.code:65:31: note: in expansion of macro ‘sc’ 65 | sc(x);sc(y); | ^~