版本比较
心连心std
正文
增加 10 行删除 10 行
5 行未改动6789101112131461 行未改动76777879808182838448 行未改动13313413513613713813914014174 行未改动21621721821922022122222322422522622787 行未改动315316317318319320321322323324325100 行未改动5 行未改动//#define debugdp1//#define debugres//#define debug2//#define debug3//#define debugloop//#define debugREusing namespace std;const int N=100005;int n,loophead,looplen;61 行未改动#endiffor(int i=0;i<g[u].size();i++)if(g[u][i]!=f[u]&&!onloop[g[u][i]]){f[g[u][i]]=u;dfs0(g[u][i]);dp0[u]-=dp0[g[u][i]];dp0[u]-=1;//send -1}48 行未改动detectloop();for(int i=1;i<=n;i++)if(onloop[i]) dfs0(i);long long res,mark/*edge mark*/,u,opu,opm;//caculation of all node_out1 type//start with loopheadres=0;res+=dp1[loophead][1];74 行未改动}#ifdef debugrescout<<'\n';#endif//caculation of all node_out-1 type//start with loopheadres=0;res+=dp1[loophead][0];87 行未改动}#ifdef debugrescout<<'\n';#endif//caculation of all loopedge type//start with loophead---f[loophead]res=1;mark=-1,u=f[loophead];100 行未改动5 行未改动6789101112131461 行未改动76777879808182838448 行未改动13313413513613713813914014174 行未改动21621721821922022122222322422522622787 行未改动315316317318319320321322323324325100 行未改动5 行未改动//#define debugdp1//#define debugres//#define debug2//#define debug3//#define debugloop//#define debugREusing namespace std;const int N=100005;int n,loophead,looplen;61 行未改动#endiffor(int i=0;i<g[u].size();i++)if(g[u][i]!=f[u]&&!onloop[g[u][i]]){f[g[u][i]]=u;dfs0(g[u][i]);dp0[u]-=dp0[g[u][i]];dp0[u]-=1;//send -1}48 行未改动detectloop();for(int i=1;i<=n;i++)if(onloop[i]) dfs0(i);long long res,mark/*edge mark*/,u,opu,opm;//caculation of all node_out1 type//start with loopheadres=0;res+=dp1[loophead][1];74 行未改动}#ifdef debugrescout<<'\n';#endif//caculation of all node_out-1 type//start with loopheadres=0;res+=dp1[loophead][0];87 行未改动}#ifdef debugrescout<<'\n';#endif//caculation of all loopedge type//start with loophead---f[loophead]res=1;mark=-1,u=f[loophead];100 行未改动