摘要: # 头文件 - 一般不用 `` - 想到什么写什么 - 不用 `using namespace std` 而用 `#define sd std::` > 但是会 `using` 自己的 `namespace` # 一些宏 ```cpp #define UP(i, s, e) for(auto i=s 阅读全文
posted @ 2023-06-09 10:55 383494 阅读(19) 评论(0) 推荐(0)
摘要: 做(shui)完了网络瘤 24 题,来总结一下 本文中删去了机器人一题,用 志愿者招募 代替。 网络瘤的重点在于建图时的思路,建出的图已经不重要了。 模板类 负载平衡问题 运输问题 分别是最大流,最小费用流的模板题,无建模难度。 我跑最大流和最小费用流用的是预流推进和原始对偶。 Upd: 现在我学废 阅读全文
posted @ 2023-06-08 16:45 383494 阅读(16) 评论(0) 推荐(0)
摘要: upd: 写你的网络单纯形去 最小费用最大流(原始对偶): ```cpp namespace flow{ // mcmf}{{{ using typ = int; constexpr int V = 1, E = 1; #error V,E unset constexpr int EDGE_NIL 阅读全文
posted @ 2023-05-28 21:00 383494 阅读(19) 评论(0) 推荐(0)
摘要: ```cpp ll qmul(ll a, ll b, ll c){ a%=c, b%=c; ll w = (ld)a/c*b; ll r = (ull)a*b-(ull)w*c; return r<0?r+c:r; } ``` 阅读全文
posted @ 2023-05-24 16:20 383494 阅读(10) 评论(0) 推荐(0)
摘要: 光速最大流: ```cpp namespace flow{ // }{{{ using typ = int; constexpr int V = 1200, E = 120000; int iv, is, it; struct Edge{int to, nxt, lf;} es[E*2+2]; co 阅读全文
posted @ 2023-05-23 10:42 383494 阅读(11) 评论(0) 推荐(0)
摘要: namespace FHQ{ #define siz(x) ({Node *_a_ = x; _a_ == np ? 0 : _a_->sz; }) struct Node{ Node *ls, *rs; char val; int pri; int sz; void updsz(){ sz = 1 阅读全文
posted @ 2023-05-14 14:02 383494 阅读(22) 评论(0) 推荐(0)
摘要: int exgcd(int a, int b, int &x, int &y){ if(!b){ x=1, y=0; return a; } int d = exgcd(b, a%b, x, y); sd swap(x, y); y -= a/b*x; return d; } 阅读全文
posted @ 2023-05-07 20:29 383494 阅读(13) 评论(0) 推荐(0)
摘要: P3426 #include <cstdio> #include <cstring> #include <vector> #define sd std:: namespace m{ // } constexpr int LEN = 1e6; sd vector<int> prepare(char* 阅读全文
posted @ 2023-05-02 14:33 383494 阅读(21) 评论(0) 推荐(0)
摘要: luogu P2123 题目描述 皇后有 $n$ 位大臣,每位大臣的左右手上面分别写上了一个正整数。恰逢国庆节来临,皇后决定为 $n$ 位大臣颁发奖金,其中第 $i$ 位大臣所获得的奖金数目为第 $i-1$ 位大臣所获得奖金数目与前 $i$ 位大臣左手上的数的和的较大值再加上第 $i$ 位大臣右手上 阅读全文
posted @ 2023-04-29 20:42 383494 阅读(66) 评论(0) 推荐(0)
摘要: 自己口胡版:就是在 \(\mathbf{Z}_p[\sqrt g]\) 上做 NTT,\(g\) 为 \(p\) 的二次非剩余。 原版:就是在 \(\mathbf{Z}_p[\sqrt{-1}]\) 上做 NTT。要求 \(-1\) 为 \(p\) 的二次非剩余。 感兴趣的可以看看提交记录 两者均被 阅读全文
posted @ 2023-04-02 10:48 383494 阅读(77) 评论(0) 推荐(0)