摘要:
#include <map> #include <cmath> #include <queue> #include <vector> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #includ 阅读全文
摘要:
const int Maxn = 1e6; const int Maxkind = 26; struct Ac_Automata { int cnt; int End[Maxn + 5]; int Tire[Maxkind + 5][Maxn + 5]; int dout[Maxn + 5]; vo 阅读全文
摘要:
1.前言 真好玩,蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤蛤 2.题解 令 G ( x ) = { 1 , 2 ∣ x 2 , 2 ∤ x g c d ( k 2 i + 1 , k 2 i + 1 + 1 ) = g c d ( k 2 i + 1 , k 2 i + 1 − k 2 i ) = g 阅读全文
摘要:
const int Maxn = 1e5; const int Maxm = 1e5; const LL Inf = 0x3f3f3f3f; struct edge { int to[Maxm * 2 + 5], Next[Maxm * 2 + 5]; LL val[Maxm * 2 + 5]; i 阅读全文
摘要:
一、背景 d i j k s t r a dijkstra dijkstra 不能处理负边权,比如这个图就会挂掉。 它的过程是 1 → 2 , 1 → 3 1 \rightarrow 2, 1 \rightarrow 3 1→2,1→3,然后就结束了。 为了处理有负权的图,我们要想一个优秀的东西去解 阅读全文
摘要:
const int Maxn = 1e4; const int Maxm = 1e5; const int Maxq = 1e7; const LL Limit = 1e14; const LL Inf = 0x3f3f3f3f3f3f3f; struct Date { int x, y; LL f 阅读全文
摘要:
struct edge { int to[Maxm * 2 + 5], Next[Maxm * 2 + 5]; LL val[Maxm * 2 + 5]; int len, Head[Maxn + 5]; void Init () { len = 1; memset (Head, 0, sizeof 阅读全文
摘要:
一、前言 上课时,有些同学对算法的解释是错误的,好像不是非常清楚做法的原理(?),在此写一篇 blog 记录原理赠与自己与他人。 二、算法 1.无源汇上下界可行流 n n n 个点, m m m 条边,每条边 e e e 有一个流量下界 l o w e r ( e ) lower(e) lower( 阅读全文
摘要:
一、二分图匹配 1.最大匹配 ∣ M a t c h ∣ = ∣ X ∣ − m a x ( ∣ Y ∣ − ∣ N Y ∣ ) |Match| = |X| - max (|Y| - |N_Y|) ∣Match∣=∣X∣−max(∣Y∣−∣NY∣) ( N Y N_Y NY 表示右部的有边和左部 阅读全文
摘要:
公式一 f ( n ) = ∑ i = m n ( n i ) g ( i ) ⇒ g ( n ) = ∑ i = m n ( − 1 ) n − i ( n i ) f ( i ) \begin{aligned} f (n) &= \sum_{i = m}^{n} \binom{n}{i} g(i 阅读全文