Submission #52667443
Source Code Expand
/*
author: honglan0301
Sexy_goodier _ xiaoqing
*/
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <queue>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <cmath>
#include <random>
#include <set>
#include <bitset>
#include <assert.h>
using namespace std;
//namespace Fread{const int SIZE=1<<20;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return*S++;}}using namespace Fread;namespace Fwrite{const int SIZE=1<<20;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}using namespace Fwrite;
//#define getchar Fread::getchar
//#define putchar Fwrite::putchar
namespace Fastio{struct Reader{template<typename T>Reader&operator>>(T&x){x=0;short f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();x*=f;return*this;}Reader&operator>>(double&x){x=0;double t=0;short f=1,s=0;char c=getchar();while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else{x*=f;return*this;}while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}Reader&operator>>(long double&x){x=0;long double t=0;short f=1,s=0;char c=getchar();while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else{x*=f;return*this;}while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}Reader&operator>>(__float128&x){x=0;__float128 t=0;short f=1,s=0;char c=getchar();while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else{x*=f;return*this;}while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}Reader&operator>>(char&c){c=getchar();while(c==' '||c=='\n'||c=='\r')c=getchar();return*this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c==' '||c=='\n'||c=='\r')c=getchar();while(c!=' '&&c!='\n'&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}Reader&operator>>(string&str){str.clear();char c=getchar();while(c==' '||c=='\n'||c=='\r')c=getchar();while(c!=' '&&c!='\n'&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';struct Writer{const int Setprecision=6;typedef int mxdouble;template<typename T>Writer&operator<<(T x){if(x==0){putchar('0');return*this;}if(x<0)putchar('-'),x=-x;static short sta[40];short top=0;while(x>0)sta[++top]=x%10,x/=10;while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(double x){if(x<0)putchar('-'),x=-x;mxdouble _=x;x-=(double)_;static short sta[40];short top=0;while(_>0)sta[++top]=_%10,_/=10;if(top==0)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_>0)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(long double x){if(x<0)putchar('-'),x=-x;mxdouble _=x;x-=(long double)_;static short sta[40];short top=0;while(_>0)sta[++top]=_%10,_/=10;if(top==0)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_>0)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(__float128 x){if(x<0)putchar('-'),x=-x;mxdouble _=x;x-=(__float128)_;static short sta[40];short top=0;while(_>0)sta[++top]=_%10,_/=10;if(top==0)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_>0)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(char c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}Writer&operator<<(string str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}using namespace Fastio;
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl//;fflush(stdout)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define int long long
#define ll long long
#define ull unsigned long long
#define mod 998244353
#define G 3
#define Gi 332748118
mt19937 rnd(time(0));
mt19937_64 rndl(time(0));
int ksm(int x,int k) {int na=1; for(int i=1;i<=k;i<<=1) {if(i&k) na=na*x%mod; x=x*x%mod;} return na;}
int gcd(int x,int y) {return !y?x:gcd(y,x%y);}
void exgcd(int u,int v,int &x,int &y) {if(!v) return x=1,y=0,void(); exgcd(v,u%v,y,x); y-=u/v*x;}
void CRTmerge(ll la,ll lb,ll&na,ll&nb){ll g=gcd(la,na),x,y;exgcd(la,na,x,y);ll dd=(nb-lb)/g;x*=dd;na=la*na/g;nb=((x*la+lb)%na+na)%na;}
struct MF
{
#define N 1
#define NN 1
#define M 1
struct edge{int son,val,next;}edge[M];
int cnt=1,head[N],nowb[N],dis[N],ff[NN],pre[NN],s,t;
void adde(int x,int y,int z)
{
edge[++cnt]={y,z,head[x]}; head[x]=cnt;
edge[++cnt]={x,0,head[y]}; head[y]=cnt;
}
void clear(int n)
{
for(int i=0;i<=cnt;i++) edge[i]={0,0,0};
for(int i=0;i<=n;i++) head[i]=nowb[i]=dis[i]=0; cnt=1;
}
queue<int>Q;bool bfs(){memset(dis,127,sizeof(dis));dis[s]=0;Q.push(s);while(!Q.empty()){int nr=Q.front();Q.pop();for(int i=head[nr];i>0;i=edge[i].next){if(edge[i].val&&dis[nr]+1<dis[edge[i].son])dis[edge[i].son]=dis[nr]+1,Q.push(edge[i].son);}}return dis[t]<1000000000;}
int bfs2(){memset(ff,0,sizeof(ff));ff[s]=1000000000;pre[s]=-1;Q.push(s);while(!Q.empty()){int nr=Q.front();Q.pop();for(int i=head[nr];i>0;i=edge[i].next){if(!ff[edge[i].son]&&edge[i].val){ff[edge[i].son]=min(edge[i].val,ff[nr]);pre[edge[i].son]=i;Q.push(edge[i].son);}}if(ff[t])break;}while(!Q.empty())Q.pop();return ff[t];}int EK(){int na=0;while(bfs2()){na+=ff[t];for(int j=pre[t];j>0;j=pre[edge[j^1].son])edge[j].val-=ff[t],edge[j^1].val+=ff[t];}return na;}
int dfs(int x,int nfl){if(x==t)return nfl;int nuse=0;for(int i=nowb[x];i>0;i=edge[i].next){nowb[x]=i;if(edge[i].val&&dis[x]+1==dis[edge[i].son]){int flw=dfs(edge[i].son,min(edge[i].val,nfl-nuse));edge[i].val-=flw;edge[i^1].val+=flw;nuse+=flw;if(nuse==nfl)break;}}return nuse;}int dinic(){int maxflow=0;while(bfs()){memcpy(nowb,head,sizeof(head));maxflow+=dfs(s,1000000000);}return maxflow;}
#undef N
#undef NN
#undef M
}MF;
struct MCMF
{
#define N 1
#define M 1
struct edge
{
int son,val,fey,next;
}edge[M];
int head[N],cnt=1,nowb[N],dis[N],dep[N],maxflow,mincost,s,t;
void adde(int x,int y,int z,int w)
{
edge[++cnt]={y,z,w,head[x]}; head[x]=cnt;
edge[++cnt]={x,0,-w,head[y]}; head[y]=cnt;
}
void clear(int n)
{
for(int i=0;i<=cnt;i++) edge[i]={0,0,0};
for(int i=0;i<=n;i++) head[i]=nowb[i]=dis[i]=dep[i]=0; cnt=1;
}
queue<int>Q;bool spfa(){memset(dis,127,sizeof(dis));dis[s]=dep[s]=0;Q.push(s);while(!Q.empty()){int nr=Q.front();Q.pop();for(int i=head[nr];i>0;i=edge[i].next){if(edge[i].val&&dis[nr]+edge[i].fey<dis[edge[i].son]){dis[edge[i].son]=dis[nr]+edge[i].fey;dep[edge[i].son]=dep[nr]+1;Q.push(edge[i].son);}}}return dis[t]<1000000000000;}int dfs(int x,int nfl){if(x==t)return mincost+=nfl*dis[t],nfl;int nuse=0;for(int i=nowb[x];i>0;i=edge[i].next){nowb[x]=i;if(edge[i].val&&dis[x]+edge[i].fey==dis[edge[i].son]&&dep[x]+1==dep[edge[i].son]){int flw=dfs(edge[i].son,min(edge[i].val,nfl-nuse));edge[i].val-=flw;edge[i^1].val+=flw;nuse+=flw;if(nuse==nfl)break;}}return nuse;}pair<int,int>dinic(){maxflow=mincost=0;while(spfa()){memcpy(nowb,head,sizeof(nowb));maxflow+=dfs(s,1000000000);}return mp(maxflow,mincost);}
#undef N
#undef M
}MCMF;
struct SA
{
#define N 1
#define M 135
int s[N],rk[N],sa[N],lrk[N],buc[N],id[N],ht[N];
void build(int n){int m=M,p=0;for(int i=1;i<=n;i++)buc[rk[i]=s[i]]++;for(int i=1;i<=M;i++)buc[i]+=buc[i-1];for(int i=1;i<=n;i++)sa[buc[rk[i]]--]=i;for(int w=1;w<=n;w<<=1){for(int i=n-w+1;i<=n;i++)id[++p]=i;for(int i=1;i<=n;i++)if(sa[i]>w)id[++p]=sa[i]-w;memcpy(lrk,rk,sizeof(rk));memset(buc,0,(m+1)<<2);p=0;for(int i=1;i<=n;i++)buc[lrk[i]]++;for(int i=1;i<=m;i++)buc[i]+=buc[i-1];for(int i=n;i>=1;i--)sa[buc[lrk[id[i]]]--]=id[i];for(int i=1;i<=n;i++)rk[sa[i]]=(lrk[sa[i]]==lrk[sa[i-1]]&&lrk[sa[i]+w]==lrk[sa[i-1]+w])?p:++p;m=p;p=0;if(m==n)break;}for(int i=1,k=0;i<=n;i++){k--;if(k<0)k++;while(s[i+k]==s[sa[rk[i]-1]+k])k++;ht[rk[i]]=k;}}
#undef N
#undef M
}SA;
struct LC
{
#define N 1
int n,x[N],y[N],F[N],lf[N],nf[N];
void init(){lf[0]=1;for(int i=1;i<=n;i++){for(int j=n;j>=0;j--)lf[j]=(lf[j]*(mod-x[i])+((j>0)?lf[j-1]:0))%mod;}for(int i=1;i<=n;i++){int prd=1;for(int j=1;j<=n;j++)if(i!=j)prd=prd*(x[i]-x[j]+mod)%mod;prd=ksm(prd,mod-2);for(int j=n;j>=0;j--)nf[j]=(lf[j+1]+x[i]*nf[j+1])%mod;for(int j=0;j<=n;j++)F[j]=(F[j]+y[i]*nf[j]%mod*prd)%mod;}}
int solve(int k){int na=0;for(int i=n;i>=0;i--)na=(na*k+F[i])%mod;return na;}
#undef N
}LC;
struct LO
{
struct node
{
int cntu,cntr,sums;
friend node operator+(node x,node y)
{
node z;
z.cntu=(x.cntu+y.cntu)%mod; z.cntr=(x.cntr+y.cntr)%mod;
z.sums=(x.sums+y.sums+x.cntu*y.cntr)%mod; return z;
}
};
node getk() {node x; x.cntu=x.cntr=x.sums=0; return x;}
node getr() {node x; x.cntu=x.sums=0; x.cntr=1; return x;}
node getu() {node x; x.cntu=1; x.cntr=x.sums=0; return x;}
node ksm(node x,int k){node na=getk();for(int i=1;i<=k;i<<=1){if(i&k)na=na+x;x=x+x;}return na;}node solve(int p,int r,int q,int x,node nu,node nr){if(!x)return getk();if(p*x+r<q)return ksm(nr,x);if(p>=q||r>=q)return ksm(nu,r/q)+solve(p%q,r%q,q,x,nu,ksm(nu,p/q)+nr);int m=(p*x+r)/q;return ksm(nr,(q-r-1)/p)+nu+solve(q,(q-r-1)%p,p,m-1,nr,nu)+ksm(nr,x-(q*m-r-1)/p);}
}LO;
struct NTT
{
#define N 1
int rv[N],lim,L;
void init(int n) {lim=1,L=0; while(lim<=n) lim<<=1,L++; for(int i=0;i<lim;i++) rv[i]=(rv[i>>1]>>1)|((i&1)<<L-1);}
void work(int x[],int flag){for(int i=0;i<lim;i++)if(i<rv[i])swap(x[i],x[rv[i]]);for(int len=1;len<lim;len<<=1){int w=ksm((flag==1)?G:Gi,(mod-1)/(len<<1));for(int j=0;j<lim;j+=(len<<1)){int nw=1;for(int k=0;k<len;k++){int xx=x[j|k],yy=nw*x[j|k|len]%mod;x[j|k]=(xx+yy)%mod;x[j|k|len]=(xx-yy+mod)%mod;nw=nw*w%mod;}}}if(flag==-1){int iv=ksm(lim,mod-2);for(int i=0;i<lim;i++)x[i]=x[i]*iv%mod;}}
#undef N
}NTT;
struct FWT
{
void AND(int x[],int n,int flag){for(int len=1;len<(1<<n);len<<=1){for(int j=0;j<(1<<n);j+=(len<<1)){for(int k=0;k<len;k++){if(flag==1)x[j|k]=(x[j|k]+x[j|k|len])%mod;else x[j|k]=(x[j|k]-x[j|k|len]+mod)%mod;}}}}
void OR(int x[],int n,int flag){for(int len=1;len<(1<<n);len<<=1){for(int j=0;j<(1<<n);j+=(len<<1)){for(int k=0;k<len;k++){if(flag==1)x[j|k|len]=(x[j|k|len]+x[j|k])%mod;else x[j|k|len]=(x[j|k|len]-x[j|k]+mod)%mod;}}}}
void XOR(int x[],int n,int flag){for(int len=1;len<(1<<n);len<<=1){for(int j=0;j<(1<<n);j+=(len<<1)){for(int k=0;k<len;k++){int xx=x[j|k],yy=x[j|k|len];x[j|k]=(xx+yy)%mod;x[j|k|len]=(xx-yy+mod)%mod;}}}if(flag==-1){int iv=ksm((1<<n),mod-2);for(int i=0;i<(1<<n);i++)x[i]=x[i]*iv%mod;}}
}FWT;
/*struct PT
{
int x,y;
bool operator<(const PT &rs) {return x!=rs.x?x<rs.x:y<rs.y;}
bool operator>(const PT &rs) {return x!=rs.x?x>rs.x:y>rs.y;}
bool operator==(const PT &rs) {return x==rs.x&&y==rs.y;}
PT operator+(const PT &rs) {return {x+rs.x,y+rs.y};}
PT operator-(const PT &rs) {return {x-rs.x,y-rs.y};}
}nl,stk[1];
int arg(PT xx) {return (int)xx.x*xx.x+(int)xx.y*xx.y;}
int cross(PT xx,PT yy) {return (int)xx.x*yy.y-(int)xx.y*yy.x;}
int dot(PT xx,PT yy) {return (int)xx.x*yy.x+(int)xx.y*yy.y;}*/
struct PT
{
double x,y;
bool operator<(const PT &rs) {return x!=rs.x?x<rs.x:y<rs.y;}
bool operator>(const PT &rs) {return x!=rs.x?x>rs.x:y>rs.y;}
bool operator==(const PT &rs) {return x==rs.x&&y==rs.y;}
PT operator+(const PT &rs) {return {x+rs.x,y+rs.y};}
PT operator-(const PT &rs) {return {x-rs.x,y-rs.y};}
PT operator*(const double rs) {return {x*rs,y*rs};}
PT operator/(const double rs) {return {x/rs,y/rs};}
}nl,STK[1];
double arg(PT xx) {return xx.x*xx.x+xx.y*xx.y;}
double len(PT xx) {return sqrt(arg(xx));}
double cross(PT xx,PT yy) {return xx.x*yy.y-xx.y*yy.x;}
double dot(PT xx,PT yy) {return xx.x*yy.x+xx.y*yy.y;}
double cdis(PT xx,PT yy) {return sqrt(arg(xx-yy));}
PT rotate(PT xx,double rad) {return {xx.x*cos(rad)+xx.y*sin(rad),-xx.x*sin(rad)+xx.y*cos(rad)};}
bool cmpPT(PT xx,PT yy) {return cross(xx-nl,yy-nl)!=0?cross(xx-nl,yy-nl)<0:arg(xx-nl)<arg(yy-nl);}
void init(vector<PT> &xx)
{
sort(xx.begin(),xx.end());
xx.erase(unique(xx.begin(),xx.end()),xx.end());
int top;
nl=xx[top=0]; sort(xx.begin()+1,xx.end(),cmpPT);
for(auto i:xx)
{
while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
STK[++top]=i;
}
xx.clear(); for(int i=1;i<=top;i++) xx.pb(STK[i]);
}
void init2(vector<PT> &xx)
{
int top; nl=xx[top=0];
for(auto i:xx)
{
while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
STK[++top]=i;
}
xx.clear(); for(int i=1;i<=top;i++) xx.pb(STK[i]);
}
vector<PT> merge(vector<PT> xx,vector<PT> yy)
{
vector<PT> na,nx,ny; na.pb(xx[0]+yy[0]); int L=xx.size(),R=yy.size(),cntl=0,cntr=0;
for(int i=0;i<L;i++) nx.pb(xx[(i+1)%L]-xx[i]); for(int i=0;i<R;i++) ny.pb(yy[(i+1)%R]-yy[i]);
while(cntl<L&&cntr<R) {int cc=cross(nx[cntl],ny[cntr]); na.pb(na.back()+((cc<0||!cc&&nx[cntl]>ny[cntr])?nx[cntl++]:ny[cntr++]));}
while(cntl+1<L) na.pb(na.back()+nx[cntl++]);
while(cntr+1<R) na.pb(na.back()+ny[cntr++]); return na;
}
int n,m,x[15],y[15],a[505][15],bh[505],nx[15],ny[15],zt[505],bx[505];
int mxn[15],nmx[15];
int getrd(int l,int r)
{
return l+(rnd()%(r-l+1));
}
int calc(int ff)
{
for(int i=1;i<=n;i++) nx[i]=x[i],ny[i]=y[i];
int ok=1;
for(int j=1;j<=n;j++)
{
if(ff&(1<<j-1)) bx[mxn[j]]|=1,nx[j]=max(nx[j],a[mxn[j]][j]); else bx[mxn[j]]|=2,ny[j]=max(ny[j],a[mxn[j]][j]);
if(bx[mxn[j]]==3) ok=0;
}
int cc=getrd(0,5);
for(int i=1;i<=cc;i++)
{
int pp=getrd(1,m);
if(bx[pp]) continue;
bx[pp]=getrd(1,2);
if(bx[pp]==1)
{
for(int j=1;j<=n;j++) nx[j]=max(nx[j],a[pp][j]);
}
else
{
for(int j=1;j<=n;j++) ny[j]=max(ny[j],a[pp][j]);
}
}
for(int j=1;j<=n;j++) bx[mxn[j]]=0;
if(!ok) return 1000000000;
for(int t=1;t<=m;t++)
{
int i=bh[t];
int dt1=0,dt2=0;
for(int j=1;j<=n;j++) dt1+=max(nx[j],a[i][j])-nx[j],dt2+=max(ny[j],a[i][j])-ny[j];
if(dt1<dt2||dt1==dt2&&rnd()&1)
{
zt[i]=1;
for(int j=1;j<=n;j++) nx[j]=max(nx[j],a[i][j]);
}
else
{
zt[i]=2;
for(int j=1;j<=n;j++) ny[j]=max(ny[j],a[i][j]);
}
}
int na=0;
for(int i=1;i<=n;i++) na+=nx[i]+ny[i]; return na;
}
signed main()
{
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>x[i];
for(int i=1;i<=n;i++) cin>>y[i];
for(int i=1;i<=m;i++) for(int j=1;j<=n;j++) cin>>a[i][j];
for(int i=1;i<=m;i++) bh[i]=i;
int ans=1000000000;
shuffle(bh+1,bh+m+1,rnd);
for(int i=1;i<=n;i++)
{
for(int t=1;t<=m;t++)
{
int j=bh[t];
if(a[j][i]>a[mxn[i]][i]) mxn[i]=j,nmx[i]=a[j][i];
}
}
int tt=0;
while(clock()<=1.9*CLOCKS_PER_SEC)
{
tt++; if(tt>=(1<<n)) tt-=(1<<n);
shuffle(bh+1,bh+m+1,rnd);
ans=min(ans,calc(tt));
}
cout<<ans<<endl;
}
Submission Info
| Submission Time |
|
| Task |
E - Max Vector |
| User |
honglan0301 |
| Language |
C++ 17 (gcc 12.2) |
| Score |
0 |
| Code Size |
15579 Byte |
| Status |
WA |
| Exec Time |
1904 ms |
| Memory |
3832 KiB |
Compile Error
Main.cpp: In member function ‘void MF::clear(long long int)’:
Main.cpp:64:17: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
64 | for(int i=0;i<=n;i++) head[i]=nowb[i]=dis[i]=0; cnt=1;
| ^~~
Main.cpp:64:65: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
64 | for(int i=0;i<=n;i++) head[i]=nowb[i]=dis[i]=0; cnt=1;
| ^~~
Main.cpp: In member function ‘void MCMF::clear(long long int)’:
Main.cpp:90:55: warning: missing initializer for member ‘MCMF::edge::next’ [-Wmissing-field-initializers]
90 | for(int i=0;i<=cnt;i++) edge[i]={0,0,0};
| ^
Main.cpp:91:17: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
91 | for(int i=0;i<=n;i++) head[i]=nowb[i]=dis[i]=dep[i]=0; cnt=1;
| ^~~
Main.cpp:91:72: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
91 | for(int i=0;i<=n;i++) head[i]=nowb[i]=dis[i]=dep[i]=0; cnt=1;
| ^~~
Main.cpp: In member function ‘void NTT::init(long long int)’:
Main.cpp:139:117: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses]
139 | void init(int n) {lim=1,L=0; while(lim<=n) lim<<=1,L++; for(int i=0;i<lim;i++) rv[i]=(rv[i>>1]>>1)|((i&1)<<L-1);}
| ~^~
Main.cpp: In function ‘std::vector<PT> merge(std::vector<PT>, std::vector<PT>)’:
Main.cpp:209:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
209 | for(int i=0;i<L;i++) nx.pb(xx[(i+1)%L]-xx[i]); for(int i=0;i<R;i++) ny.pb(yy[(i+1)%R]-yy[i]);
| ^~~
Main.cpp:209:56: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
209 | for(int i=0;i<L;i++) nx.pb(xx[(i+1)%L]-xx[i]); for(int i=0;i<R;i++) ny.pb(yy[(i+1)%R]-yy[i]);
| ^~~
Main.cpp:210:92: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
210 | while(cntl<L&&cntr<R) {int cc=cross(nx[cntl],ny[cntr]); na.pb(na.back()+((cc<0||!cc&&nx[cntl]>ny[cntr])?nx[cntl++]:ny[cntr++]));}
Main.cpp:212:9: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
212 | while(cntr+1<R) na.pb(na.back()+ny[cntr++]); return na;
| ^~~~~
Main.cpp:212:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
212 | while(cntr+1<R) na.pb(na.back()+ny[cntr++]); return na;
| ^~~~~~
Main.cpp: In function ‘long long int calc(long long int)’:
Main.cpp:229:28: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses]
229 | if(ff&(1<<j-1)) bx[mxn[j]]|=1,nx[j]=max(nx[j],a[mxn[j]][j]); else bx[mxn[j]]|=2,ny[j]=max(ny[j],a[mxn[j]][j]);
| ~^~
Main.cpp:254:37: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
254 | if(dt1<dt2||dt1==dt2&&rnd()&1)
| ~~~~~~~~^~~~~~~~~
Main.cpp:266:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
266 | for(int i=1;i<=n;i++) na+=nx[i]+ny[i]; return na;
| ^~~
Main.cpp:266:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
266 | for(int i=1;i<=n;i++) na+=nx[i]+ny[i]; return na;
| ^~~~~~
Main.cpp: In function ‘void init2(std::vector<PT>&)’:
Main.cpp:204:56: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
204 | xx.clear(); for(int i=1;i<=top;i++) xx.pb(STK[i]);
| ~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:201:55: warning: array subscript 2 is above array bounds of ‘PT [1]’ [-Warray-bounds]
201 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:201:66: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
201 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:201:55: warning: array subscript 2 is above array bounds of ‘PT [1]’ [-Warray-bounds]
201 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:201:66: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
201 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:202:26: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
202 | STK[++top]=i;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:202:26: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
202 | STK[++top]=i;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp: In function ‘void init(std::vector<PT>&)’:
Main.cpp:194:56: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
194 | xx.clear(); for(int i=1;i<=top;i++) xx.pb(STK[i]);
| ~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:191:55: warning: array subscript 2 is above array bounds of ‘PT [1]’ [-Warray-bounds]
191 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:191:66: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
191 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:191:55: warning: array subscript 2 is above array bounds of ‘PT [1]’ [-Warray-bounds]
191 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:191:66: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
191 | while(top>=2&&cross(i-STK[top],STK[top]-STK[top-1])<=0) top--;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:192:26: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
192 | STK[++top]=i;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Main.cpp:192:26: warning: array subscript 1 is above array bounds of ‘PT [1]’ [-Warray-bounds]
192 | STK[++top]=i;
| ~~~~~~~~~^
Main.cpp:174:5: note: while referencing ‘STK’
174 | }nl,STK[1];
| ^~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
0 / 800 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
example_00.txt, example_01.txt, example_02.txt |
| All |
example_00.txt, example_01.txt, example_02.txt, killer_00.txt, killer_01.txt, killer_02.txt, killer_03.txt, killer_04.txt, killer_05.txt, killer_06.txt, killer_07.txt, killer_08.txt, killer_09.txt, killer_10.txt, killer_11.txt, killer_12.txt, killer_13.txt, killer_14.txt, killer_15.txt, killer_16.txt, killer_17.txt, killer_18.txt, killer_19.txt, killer_20.txt, killer_21.txt, killer_22.txt, killer_23.txt, killer_24.txt, killer_25.txt, killer_26.txt, killer_27.txt, killer_28.txt, killer_29.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt, test_62.txt, test_63.txt, test_64.txt, test_65.txt, test_66.txt, test_67.txt, test_68.txt, test_69.txt, test_70.txt, test_71.txt, test_72.txt, test_73.txt, test_74.txt, test_75.txt, test_76.txt, test_77.txt |
| Case Name |
Status |
Exec Time |
Memory |
| example_00.txt |
AC |
1901 ms |
3612 KiB |
| example_01.txt |
AC |
1903 ms |
3764 KiB |
| example_02.txt |
AC |
1903 ms |
3568 KiB |
| killer_00.txt |
AC |
1901 ms |
3688 KiB |
| killer_01.txt |
AC |
1903 ms |
3596 KiB |
| killer_02.txt |
AC |
1902 ms |
3680 KiB |
| killer_03.txt |
AC |
1900 ms |
3552 KiB |
| killer_04.txt |
AC |
1903 ms |
3600 KiB |
| killer_05.txt |
AC |
1902 ms |
3712 KiB |
| killer_06.txt |
AC |
1903 ms |
3828 KiB |
| killer_07.txt |
AC |
1903 ms |
3680 KiB |
| killer_08.txt |
AC |
1903 ms |
3684 KiB |
| killer_09.txt |
AC |
1901 ms |
3640 KiB |
| killer_10.txt |
AC |
1903 ms |
3752 KiB |
| killer_11.txt |
AC |
1903 ms |
3672 KiB |
| killer_12.txt |
AC |
1903 ms |
3708 KiB |
| killer_13.txt |
AC |
1903 ms |
3688 KiB |
| killer_14.txt |
AC |
1902 ms |
3616 KiB |
| killer_15.txt |
AC |
1900 ms |
3556 KiB |
| killer_16.txt |
AC |
1903 ms |
3712 KiB |
| killer_17.txt |
AC |
1903 ms |
3664 KiB |
| killer_18.txt |
AC |
1903 ms |
3624 KiB |
| killer_19.txt |
AC |
1902 ms |
3716 KiB |
| killer_20.txt |
AC |
1902 ms |
3672 KiB |
| killer_21.txt |
AC |
1903 ms |
3744 KiB |
| killer_22.txt |
AC |
1903 ms |
3832 KiB |
| killer_23.txt |
AC |
1903 ms |
3708 KiB |
| killer_24.txt |
AC |
1903 ms |
3688 KiB |
| killer_25.txt |
AC |
1903 ms |
3712 KiB |
| killer_26.txt |
AC |
1903 ms |
3640 KiB |
| killer_27.txt |
AC |
1901 ms |
3712 KiB |
| killer_28.txt |
AC |
1901 ms |
3712 KiB |
| killer_29.txt |
AC |
1900 ms |
3548 KiB |
| test_00.txt |
AC |
1902 ms |
3544 KiB |
| test_01.txt |
AC |
1903 ms |
3784 KiB |
| test_02.txt |
AC |
1904 ms |
3672 KiB |
| test_03.txt |
AC |
1901 ms |
3616 KiB |
| test_04.txt |
AC |
1903 ms |
3688 KiB |
| test_05.txt |
AC |
1903 ms |
3676 KiB |
| test_06.txt |
AC |
1900 ms |
3804 KiB |
| test_07.txt |
AC |
1903 ms |
3772 KiB |
| test_08.txt |
AC |
1903 ms |
3672 KiB |
| test_09.txt |
AC |
1903 ms |
3544 KiB |
| test_10.txt |
AC |
1903 ms |
3812 KiB |
| test_11.txt |
AC |
1903 ms |
3688 KiB |
| test_12.txt |
AC |
1902 ms |
3640 KiB |
| test_13.txt |
AC |
1903 ms |
3604 KiB |
| test_14.txt |
WA |
1903 ms |
3708 KiB |
| test_15.txt |
AC |
1902 ms |
3644 KiB |
| test_16.txt |
AC |
1903 ms |
3684 KiB |
| test_17.txt |
AC |
1902 ms |
3688 KiB |
| test_18.txt |
AC |
1903 ms |
3628 KiB |
| test_19.txt |
AC |
1903 ms |
3632 KiB |
| test_20.txt |
AC |
1903 ms |
3632 KiB |
| test_21.txt |
AC |
1902 ms |
3572 KiB |
| test_22.txt |
AC |
1903 ms |
3636 KiB |
| test_23.txt |
AC |
1903 ms |
3768 KiB |
| test_24.txt |
AC |
1902 ms |
3640 KiB |
| test_25.txt |
AC |
1903 ms |
3632 KiB |
| test_26.txt |
AC |
1903 ms |
3564 KiB |
| test_27.txt |
AC |
1903 ms |
3644 KiB |
| test_28.txt |
AC |
1903 ms |
3612 KiB |
| test_29.txt |
AC |
1903 ms |
3628 KiB |
| test_30.txt |
AC |
1900 ms |
3616 KiB |
| test_31.txt |
AC |
1903 ms |
3620 KiB |
| test_32.txt |
AC |
1903 ms |
3664 KiB |
| test_33.txt |
AC |
1900 ms |
3600 KiB |
| test_34.txt |
AC |
1903 ms |
3616 KiB |
| test_35.txt |
AC |
1903 ms |
3704 KiB |
| test_36.txt |
AC |
1904 ms |
3632 KiB |
| test_37.txt |
AC |
1903 ms |
3816 KiB |
| test_38.txt |
AC |
1901 ms |
3640 KiB |
| test_39.txt |
AC |
1903 ms |
3624 KiB |
| test_40.txt |
AC |
1903 ms |
3772 KiB |
| test_41.txt |
AC |
1903 ms |
3628 KiB |
| test_42.txt |
AC |
1903 ms |
3640 KiB |
| test_43.txt |
AC |
1903 ms |
3552 KiB |
| test_44.txt |
AC |
1903 ms |
3660 KiB |
| test_45.txt |
AC |
1903 ms |
3764 KiB |
| test_46.txt |
AC |
1901 ms |
3632 KiB |
| test_47.txt |
AC |
1902 ms |
3700 KiB |
| test_48.txt |
AC |
1903 ms |
3800 KiB |
| test_49.txt |
AC |
1903 ms |
3684 KiB |
| test_50.txt |
AC |
1900 ms |
3792 KiB |
| test_51.txt |
AC |
1903 ms |
3608 KiB |
| test_52.txt |
AC |
1902 ms |
3620 KiB |
| test_53.txt |
AC |
1903 ms |
3700 KiB |
| test_54.txt |
AC |
1902 ms |
3592 KiB |
| test_55.txt |
AC |
1903 ms |
3664 KiB |
| test_56.txt |
AC |
1903 ms |
3584 KiB |
| test_57.txt |
AC |
1902 ms |
3568 KiB |
| test_58.txt |
AC |
1903 ms |
3616 KiB |
| test_59.txt |
AC |
1903 ms |
3828 KiB |
| test_60.txt |
AC |
1903 ms |
3640 KiB |
| test_61.txt |
AC |
1901 ms |
3828 KiB |
| test_62.txt |
AC |
1903 ms |
3688 KiB |
| test_63.txt |
AC |
1900 ms |
3684 KiB |
| test_64.txt |
AC |
1900 ms |
3824 KiB |
| test_65.txt |
AC |
1903 ms |
3688 KiB |
| test_66.txt |
AC |
1903 ms |
3684 KiB |
| test_67.txt |
AC |
1903 ms |
3712 KiB |
| test_68.txt |
AC |
1901 ms |
3672 KiB |
| test_69.txt |
AC |
1903 ms |
3680 KiB |
| test_70.txt |
AC |
1903 ms |
3672 KiB |
| test_71.txt |
AC |
1903 ms |
3644 KiB |
| test_72.txt |
AC |
1903 ms |
3640 KiB |
| test_73.txt |
AC |
1903 ms |
3684 KiB |
| test_74.txt |
AC |
1903 ms |
3668 KiB |
| test_75.txt |
AC |
1903 ms |
3548 KiB |
| test_76.txt |
AC |
1903 ms |
3680 KiB |
| test_77.txt |
AC |
1904 ms |
3696 KiB |