图论
文章平均质量分 62
codeducker
逢山开路,遇水架桥
展开
-
ACM图论学习笔记
ACM图论学习笔记(模板)原创 2022-04-17 22:56:58 · 419 阅读 · 0 评论 -
最近公共祖先LCA(模板)
最近公共祖先LCA(模板)效率比较树链求LCAconst int N=5e5+5;const int M=1e6+5;struct LS{ int cnt=0; struct cpp { int to,cost,next; }edge[N*2]; int head[ N ]; void inta(){ cnt=0; memset( head,-1,sizeof(head) ); } void原创 2021-10-30 21:32:55 · 100 阅读 · 0 评论 -
The Shortest Path in Nya Graph [kuangbin带你飞]刷题记录
- The Shortest Path in Nya Graph核心思想,将每一层建立俩个辅助点,如图,让该层的所有点与这两个点相连,边权分别为c与0,就成功地把建边的时间复杂度大大缩小了,如图AC代码#include<iostream>#include<queue>#include<string>#include<string.h>#include<algorithm>#include<cstdio>#inc原创 2021-08-06 22:16:17 · 93 阅读 · 0 评论