摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef int ll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20, 阅读全文
posted @ 2026-11-27 08:34 beiciqi 阅读(9) 评论(0) 推荐(1)
摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef int ll; typedef long long lll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p1= 阅读全文
posted @ 2026-11-27 08:23 beiciqi 阅读(5) 评论(0) 推荐(0)
摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1, 阅读全文
posted @ 2026-11-24 21:43 beiciqi 阅读(5) 评论(0) 推荐(0)
摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1, 阅读全文
posted @ 2026-11-24 21:41 beiciqi 阅读(10) 评论(0) 推荐(1)
摘要: 预处理欧拉函数版 const ll maxn=1e5+5; ll n,pcnt,phi[maxn],pri[maxn]; bool ispri[maxn]; inline void getphi(){ phi[1]=1; for(ll i=2;i<=n;i++){ if(!ispri[i]){ pr 阅读全文
posted @ 2026-11-24 20:11 beiciqi 阅读(7) 评论(0) 推荐(1)
摘要: C++ 模板大全(二) 可通过点击右下角打开目录,快速跳转到你想要的章节。 怕以后找不到的话,可以收藏本文或关注我哦。 模板难度层层递进,跟着本文复习模板,效果会更好哦。(本篇有些内容附简略讲解) 这是上一集:C++ 模板大全(一)。 【模板】网络最大流 题目跳转 代码 #include<bits/ 阅读全文
posted @ 2026-11-22 20:27 beiciqi 阅读(38) 评论(0) 推荐(1)
摘要: 题目跳转 代码 速度快但不好记 #include<bits/stdc++.h> using namespace std; typedef int ll; typedef long long lll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&& 阅读全文
posted @ 2026-11-22 20:21 beiciqi 阅读(4) 评论(0) 推荐(0)
摘要: 题目跳转 对于所有负权边,建下界为 \(0\)、上界为 \(f\)、费用为 \(−v\) 的边 \((y,x)\);同时建一条虚拟边:上界为 \(f\)、下界为\(f\),按照上下界网络流套路统计每个点入流量和出流量的差(设为 \(w\))。 对于所有正权边,建下界为 \(0\)、上界为 \(f\) 阅读全文
posted @ 2026-11-22 19:38 beiciqi 阅读(4) 评论(0) 推荐(0)
摘要: 题目跳转 讲解。 先新建一条从 \(t\) 到 \(s\),限制为 \([0,+\infty]\) 的边。 接下来跑无源汇上下界可行流,注意原图源汇点 \(s\) 和 \(t\) 与附加源汇点 \(s′\) 和 \(t′\) 不同。 将新建的 \((t,s)\) 这条边删去。 然后用原来的源汇在残量 阅读全文
posted @ 2026-11-22 19:05 beiciqi 阅读(4) 评论(0) 推荐(0)
摘要: 题目跳转 讲解。 先新建一条从 \(t\) 到 \(s\),限制为 \([0,+\infty]\) 的边。 接下来跑无源汇上下界可行流,注意原图源汇点 \(s\) 和 \(t\) 与附加源汇点 \(s′\) 和 \(t′\) 不同。 将新建的 \((t,s)\) 这条边删去。 然后用原来的源汇在残量 阅读全文
posted @ 2026-11-22 18:59 beiciqi 阅读(3) 评论(0) 推荐(0)
摘要: 题目跳转 讲解。 先统计下界网络中每个点的流出量和流入量,称 \(\text{下界净流量} = \text{流入量} - \text{流出量}\)。 下界净流量大于 \(0\) 的连源点 \(s\),容量为其下界净流量;小于 \(0\) 的连汇点,容量为其下界净流量的绝对值。 跑 \(s\) 到 \ 阅读全文
posted @ 2026-11-22 18:10 beiciqi 阅读(8) 评论(0) 推荐(0)
摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef int ll; typedef pair<ll,ll> pll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p 阅读全文
posted @ 2026-11-22 17:52 beiciqi 阅读(8) 评论(0) 推荐(0)
摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef int ll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20, 阅读全文
posted @ 2026-11-16 18:47 beiciqi 阅读(11) 评论(0) 推荐(0)
摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef int ll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20, 阅读全文
posted @ 2026-11-16 17:35 beiciqi 阅读(5) 评论(0) 推荐(0)
摘要: 题目跳转 代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; uint8_t buf[1<<20],*p1,*p2; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1, 阅读全文
posted @ 2026-11-16 16:50 beiciqi 阅读(5) 评论(0) 推荐(0)