文章标题
来源:互联网 发布:html 文字游戏源码 编辑:程序博客网 时间:2024/06/16 04:46
//针对有向图void dfs(int x) { f[x]=true; d[x]=low[x]=++Time; sta.push(x);instack[x]=true; for (int e=head[x];e!=0;e=next[e]) { if (!f[vet[e]]) { dfs(vet[e]); low[x]=min(low[x],low[vet[e]]); } else if (instack[vet[e]]) low[x]=min(low[x],d[vet[e]]); } if (low[x]==d[x]) { idnum++; while (sta.top()!=x) { instack[sta.top()]=false; idc[sta.top()]=idnum; sta.pop(); } idc[x]=idnum; instack[x]=false; sta.pop(); }}int main() { int n; cin >> n; while (!sta.empty()) sta.pop(); for (int i=1;i<=n;i++) if (!f[i]) dfs(i); for (int i=1;i<=n;i++) for (int e=head[i];e!=0;e=next[e])//遍历每条边 if (idc[i]!=idc[vet[e]]) ind[idc[vet[e]]]++; return 0;}
阅读全文
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 习题6.3
- 使用无线数传 radio telemetry 连接pixhawk进入offboard模式进行mavlink协议通讯的尝试
- 深入理解mysql
- 洛谷3366 最小生成树模板题
- 蓝桥杯 算法训练 删除数组零元素
- 文章标题
- 【网易】重排数列
- Yarn 资源管理
- Vim 查找&替换
- 安卓自定义控件---安卓小机器人图标在背景图片上随手指滑动,点击背景图片任意位置出现小机器人图标
- 在vue中引用公共过滤器filter
- 禁止访问磁盘的注册表
- Zookeeper Watcher核心机制·安全认证(ACL)·实际应用
- JZOJ 5444. 【NOIP2017提高A组冲刺11.2】救赎