摘要:
考虑为什么队头就是最优决策: 因为我们要找的是sum的最小值,单调队列内存储了所有可能的决策集合,而对头又是最小的 所以取对头转移就可以 #include <iostream> #include <cstdio> #include <cstring> #include <queue> using n 阅读全文
posted @ 2022-01-15 22:19
__iostream
阅读(26)
评论(0)
推荐(0)
摘要:
求窗口内最大值 #include <iostream> #include <cstdio> #include <queue> using namespace std; const int N=1e6+10; const int INF=0x3f3f3f3f; int read() { int x=0 阅读全文
posted @ 2022-01-15 22:08
__iostream
阅读(35)
评论(0)
推荐(0)
摘要:
给定一颗树,把它扩充成完全图.求需要的最小边权和 struct Edge { int x,y,z; }e[N]; int T,n; int fa[N],sz[N]; int get(int x) { if(x==fa[x]) return x; return fa[x]=get(fa[x]); } 阅读全文
posted @ 2022-01-15 17:40
__iostream
阅读(27)
评论(0)
推荐(0)
摘要:
最短路径树计数 树的计数问题 我们考虑类似prim的方式 维护树的一部分 这样就可以用乘法原理了 #include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <vector> #include 阅读全文
posted @ 2022-01-15 17:39
__iostream
阅读(34)
评论(0)
推荐(0)

浙公网安备 33010602011771号