摘要:
原题链接 题解 链式前向星版本的欧拉回路dfs void dfs(int u){ for (int i=head[u];i>0;i=head[u]){ head[u]=Next[i]; //走过的路直接跳过 dfs(to[i]); } que[l++]=u; } 接下来的难点是如何字典序搜索。我们在 阅读全文
摘要:
原题的无向图等价于上图所示的联通图,此时我们要求的就是起始位置到终止位置最少要经过几个有颜色的结点。 code #include<bits/stdc++.h> using namespace std; const int N=4e5+5; int vis[N]; int main(){ // fre 阅读全文