随笔分类 - 模板
摘要:借bzoj1624练了一下模板(虽然正解只是floyd)spfa:#include #include #include #include #include #include using namespace std;const int INF=100001;const int maxm=10001,m...
阅读全文
摘要:Description贝茜把家搬到了一个小农场,但她常常回到FJ的农场去拜访她的朋友。贝茜很喜欢路边的风景,不想那么快地结束她的旅途,于是她每次回农场,都会选择第二短的路径,而不象我们所习惯的那样,选择最短路。 贝茜所在的乡村有R(1 2 -> 4 (长度为100+200=300)第二短路:1 ->...
阅读全文
摘要:1.存边:可用邻接表或是vector;2.队列: 可用指针或是queue;
阅读全文
摘要:这里以spfa为例;//都用邻接表存边;指针:int h=1,t=1; q[h]=x; while(hdist[u]+e[i].w){ dist[v]=dist[u]+e[i].w; if(!vis[v]){ vis[v]=1; q[+...
阅读全文
摘要:存边; 对于指针实现的邻接表:struct edge{ int from,next,to,w;}E[maxn];int head[maxn],tot=0;//head初始化为-1;void add(int x,int y,int z){ E[++tot].from=x;//头结点 E[tot].to...
阅读全文

浙公网安备 33010602011771号