贴板子。求割边。将>改为>=即可判断u是否为割点。
#include#include #include using namespace std;const int INF=0x3f3f3f3f;const int maxn=20008;const int maxm=100008;struct fuck{ int u,v,next; bool ban;}edge[maxm<<1];int tol;int head[maxn];void init(){ tol=0; memset(head,-1,sizeof(head));}void addedge(int u,int v){ edge[tol].u=u; edge[tol].v=v; edge[tol].next=head[u]; edge[tol].ban=false; head[u]=tol++;}int tim=0;int pre[maxn],low[maxn];int tarj(int u,int fa){ int lowu=pre[u]=++tim; int child=0; int i,v,lowv; for(i=head[u];i!=-1;i=edge[i].next) { v=edge[i].v; if(!pre[v]) { child++; lowv=tarj(v,u); lowu=min(lowu,lowv); if(lowv>pre[u]) { edge[i].ban=true; edge[i^1].ban=true; } } else if(pre[v]