版本比较
题解 P3767 【膜法】
正文
增加 5 行删除 5 行
66 行未改动6768697071717273747521 行未改动97989910010110210110210310410510510610710810910 行未改动120121122123124124125126127128122 行未改动全部展开66 行未改动 int f,t; Rd(f,t); o[i].fa=f; o[i].e.t=t; switch(t) { case 1: case 1: case 2: {o[i].e.u=I(); o[i].e.v=I(); break;} case 3: {o[i].e.u=I(); break;} } }21 行未改动 int fa[N*5],sz[N*5]; bool vis[N*5]; // 五倍空间 bool is_legal; // 当前是否合法 struct bak{int u,v,fv,su; bool legal;} bk[N*5]; int top=0; // 把当前是否合法也要记下 int P[N][5],tot; void clear(int n)
void clear(int n) { tot=0; F(i,1,n) F(j,0,4) P[i][j]=++tot; F(i,1,n) F(j,0,4) P[i][j]=++tot; is_legal=1;
F(i,1,tot) fa[i]=i,sz[i]=1,vis[i]=0; // 这里循环到tot (写5*n也可以) while(top) bk[top--]=(bak){0,0,0,0,0};10 行未改动 bool same(int u,int v) {return find(u)==find(v);} bool illegal(int u) // 判断u是否不合法了 { F(i,0,4) vis[find(P[u][i])]=0; F(i,0,4) F(i,0,4) { int f=find(P[u][i]); if (vis[f]) return true; vis[f]=1;122 行未改动全部展开