随笔分类 - 模板
摘要:次小生成树 非严格 #include <cstring> #include <iostream> #include <queue> #include <algorithm> #include <vector> using namespace std; const int N = 1111; cons
阅读全文
摘要:Tarjan 有向图 强连通分量 void tarjan(int u) { dfn[u] = low[u] = ++times; stk[++top] = u;instk[u] = 1; for (int i = h[u]; i != -1; i = ne[i]) { int v = to[i];
阅读全文
摘要:#include<iostream> using namespace std; typedef long long ll; ll q_mul(ll a, ll b, ll p) { ll ret = 0; while (b) { if (b&1)(ret += a)%=p; b>>=1; (a<<=
阅读全文