
图论
K3_14
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
蓝桥 历届试题 网络寻路
#include #include #include #include using namespace std;int n,m,a,b,ans=0;bool vis[10010];vector v[10010]; void dfs(int x,int num,int w) { if (num==2) { for (int i=0;i<v[x].size();i++) {原创 2017-04-05 06:03:39 · 432 阅读 · 0 评论 -
图论模板
最短路1.单源bellman-ford无圈,时间效率不高,边可以为负数struct edge { int from,to,cost;} e[max_m];int n,m; //n为点数,m为边数int d[max_n];for (int i=0;i<n;i++) dis[i]=inf;d[start]=0;while (true) { bool f=false原创 2017-04-06 03:13:48 · 735 阅读 · 0 评论 -
蓝桥 灾后重建
Pear市一共有N(震后,Pear打算修复其中一些道路,修理第i条道路需要Pi的时间。不过,Pear并不打算让全部的点连通,而是选择一些标号特殊的点让他们连通。Pear有Q(你能帮助Pear计算出每次询问时需要花费的最少时间么?这里询问是独立的,也就是上一个询问里的修理计划并没有付诸行动。【输入格式】第一行三个正整数N、M、Q,含义如题面所述。接下来M行,每行三个正原创 2017-04-06 20:29:09 · 828 阅读 · 0 评论