![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ST表
VL——MOESR
ga
展开
-
【YBTOJ进阶训练指导】二叉查找树【RMQ】【dfs】【ST表】
dfs+ST表+RMQ原创 2022-03-03 20:31:20 · 158 阅读 · 0 评论 -
【YBTOJ进阶训练指导】人类基因【ST表】【RMQ】
ST表+RMQ原创 2022-03-03 19:59:57 · 74 阅读 · 0 评论 -
【YBTOJ】矩阵最值
思路:直接一个二维ST表模板codecodecode#include<iostream>#include<cstdio>#include<cmath>using namespace std;int n, m, q;int f[300][300][20][20];int main(){ scanf("%d%d%d", &n, &m, &q); for(int i=1; i<=n; i++) for(int..原创 2021-05-30 15:52:44 · 115 阅读 · 0 评论 -
【YBTOJ】与众不同
思路:last[i]表示上次i出现的位置p[i]表示这个序列的起始位置显然长度=i-p[i]+1然后对于一个区间l~r,把它分为两部分,一部分可以直接求出答案,表明p[i]<l,另一部分要求最大长度显然二分可以得到最大值就用ST表codecodecode#include<iostream>#include<cstdio>#include<cmath> using namespace std;int inf=1e6+1;int la..原创 2021-05-27 17:18:30 · 113 阅读 · 0 评论 -
【YBTOJ】静态区间
思路:依然的ST表模板codecodecode#include<iostream>#include<cstdio>#include<cmath>using namespace std;int n, m;int f[1001000][31];int gcd(int x, int y){ if(y==0) return x; return gcd(y, x%y);}int main(){ scanf("%d%d", &..原创 2021-05-22 17:08:14 · 70 阅读 · 0 评论 -
【YBTOJ】数列区间
思路:ST表模板codecodecode#include<iostream>#include<cstdio>#include<cmath>using namespace std;int n, m;int f[1001000][31];int main(){ scanf("%d%d", &n, &m); for(int i=1; i<=n; i++) { int x; scanf("%d", &x)..原创 2021-05-22 16:51:07 · 90 阅读 · 0 评论 -
P3865 【模板】ST表
链接ST表模板#include<iostream>#include<cstdio>#include<cmath>using namespace std;int m,n,a[1000100],dp[1000100][30];int main(){ scanf("%d%d",&n,&m); for(int i=1;i<=n...原创 2020-03-16 20:09:42 · 112 阅读 · 1 评论