摘要: / 二维前缀和 构建前缀和 int n,m; scanf("%d%d",&n,&m); for(int i=1;i include using namespace std; const int maxn=1e4+5; int a[maxn][maxn];//存放原数据 int main(){ int 阅读全文
posted @ 2019-09-21 17:38 Emcikem 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 传送门 给出一些点的数,进行遍历有几块 直接用dfs进行二维数组遍历会超时,所以利用set进行离散化 #include <iostream> #include <cstdio> #include <set> using namespace std; set<pair<int,int> >st; in 阅读全文
posted @ 2019-09-21 14:49 Emcikem 阅读(207) 评论(0) 推荐(0) 编辑
摘要: ST表类似树状数组,线段树这两种算法,是一种用于解决RMQ问题的离线算法。 预处理$O(nlogn)$,查询$O(1)$ 给出一个长度为$N$的数列,和$M$次查询,求出每一次询问的区间内数字的最大值 定义: $st[i][j]$表示从$i$位置开始的$2j$个数中的最大值,即$st[i][j] = 阅读全文
posted @ 2019-09-21 09:30 Emcikem 阅读(167) 评论(0) 推荐(0) 编辑